jQuery UI Widgets Forums Lists ListBox bindingComplete

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 10 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • bindingComplete #54867

    EricK
    Participant

    Howdy….

    I would like to get the record count on my listbox once it has been filled with json data when I query it a second time.
    The initial bindComplete works fine the first time. The second time I perform the query to refill the listbox with new data the bind event does not fire.
    I have set the asyn: true

    $(“#jqxListBox”).on(‘bindingComplete’, function (event) {
    var items = $(“#events”).jqxListBox(‘getItems’);
    alert(items.length);
    }

    Or is there a simpler method to get the count once the listbox has been filled.

    Thanks again,
    Eric

    bindingComplete #54889

    Dimitar
    Participant

    Hello Eric,

    If you refill the listbox by re-setting the source property, the bindingComplete event will fire and your solution will work.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    bindingComplete #54922

    EricK
    Participant

    Howdy Dimitar,

    I am new too jquery so please confirm. Will the following re-set the source?

    
    $('#calendar').on('change viewChange', function (event) {
         date = event.args.date;
         if (event.type == 'change') {
    	cdate = formatDate(date,'yyyy-MM-dd');
    	source.data = {actdate:cdate};
    	dataAdapter = new $.jqx.dataAdapter(source);
    	$("#events").jqxListBox({ source: dataAdapter });
    					
         }
    });
    
    bindingComplete #54931

    Dimitar
    Participant

    Hi EricK,

    This code should work fine as long as the source object was correctly set before that.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.