Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
function FieldList ( app ) {
/*....*/
app.getList( 'CurrentSelections', function ( reply ) {
me.selections = reply.qSelectionObject.qSelections;
//render since selections have changed
me.render();
//use qBackCount and qForwardCount to enable/disable back and forward buttons
$( "[data-qcmd='back']" ).toggleClass( 'disabled', reply.qSelectionObject.qBackCount < 1 );
$( "[data-qcmd='forward']" ).toggleClass( 'disabled', reply.qSelectionObject.qForwardCount < 1 );
} );
}
FieldList.prototype.render = function () {
var $fields = $( "#fields" ), str = "<ul class='list-group'>", added = {}, me = this;
if ( me.selections ) {
me.selections.forEach( function ( fld ) {
str += '<li class="list-group-item" data-value="' + fld.qField + '">' + fld.qField + '<span class="badge">' + fld.qSelectedCount + '/' + fld.qTotal + '</span></li>';
added[fld.qField] = true;
} );
}
/*..*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment