jQuery UI Widgets Forums Grid Initial filtering with new $.jqx.filter() and data loading

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

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

  • wavetrex
    Participant

    Hello !

    I have successfully implemented initial filters on a grid, by putting something like this:

    $myGrid.on('initialized', function() {
    	// Initial applied filter [testing]
    	var priorityFilter = new $.jqx.filter();
    	var prioF1 = priorityFilter.createfilter('stringfilter', '3.High', 'EQUAL');
    	priorityFilter.addfilter(1, prioF1);
    
    	$("#issues-grid").jqxGrid('addfilter', '_priority', priorityFilter);
    	$("#issues-grid").jqxGrid('applyfilters');
    }
    

    However, my grid uses remote data loaded from the server with a DataAdapter

    The problem is that when the grid is created, the data is loaded twice from the server.
    – First time without any filters
    – Second time with that “priorityFilter” applied

    GET http://localhost/issue/list?action=get_…index=25&custom%5Bmaxrows%5D=100&_=1383050848754 | 200 OK | 286ms
    GET http://localhost/issue/list?action=get_…index=25&custom%5Bmaxrows%5D=100&_=1383050849418 | 200 OK | 236ms

    This happen one after another without me touching the filter row, probably first one when the grid is initialized, and the second one when the even “initalized” happens and filters are applied.

    Also, the grid “flashes” when doing this, as it takes some time for the second request to return, in which time the grid is show without filters, then a second later it shows with filters on.


    My question is:

    Is there ANY way to force the grid to NOT load data from the server, and only do a load using the API ?
    This way, I can initialize the grid, maybe put some filters up, change the page, whatever… and at the end ask for a data load and display to the user.

    If not, can you please add such an option ?
    Example: “autobind” – true/false
    +
    the “refresh” method which should cause another dataBind / grid load, but I can call that only after finishing setting up filters

    Or maybe you could make another smarter way of setting this up.

    Thanks !


    Dimitar
    Participant

    Hello wavetrex,

    Unfortunately, there is no way to directly load filtered data in the grid.

    Best Regards,
    Dimitar

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


    wavetrex
    Participant

    Welp…
    No love for remotely loaded data 🙁

    Any chance of planning this feature for some of the next updates ?

    I’ve seen other threads in the past with people requesting something like this.


    Or my suggestion, a way to temporarely disable the auto-reloading of data every time a filter is changed and do a dataBind() when all the parameters have been set/changed.

    Thanks !

    P.S. I asked before a similar thing related to loading of grid state, which would also load the data twice, first in the default original state and again after a custom state has been loaded.
    The ability to disable autoupdate/autobind would be wonderful in both cases !


    Dimitar
    Participant

    Hi wavetrex,

    Please note that you can call multiple methods between beginupdate and endupdate and the grid will be refreshed only once, after endupdate, i.e.:

    $('#jqxGrid').jqxGrid('beginupdate');
    // your methods
    $('#jqxGrid').jqxGrid('endupdate');

    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.