jQuery UI Widgets Forums Grid loading jqgrid with predefined filter

This topic contains 12 replies, has 3 voices, and was last updated by  Peter Stoev 7 years, 11 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • loading jqgrid with predefined filter #19696

    ntaxa
    Member

    I need load jqxgrid with predefined filter.

    I know about autosavestate/autoloadstate but this features refresh grid after initialization. events are as follows:

    1. sending UNFILTERED data to server
    2. bindingcomplete (getstate gives empty filter)
    3. initialized (getstate gives empty filter)
    4. ready (getstate gives empty filter)
    5. sending FILTERED data to server
    6. bindingcomplete (getstate gives filled filter)
    ….

    can i somehow (in elegant way) force grid to send first request with filtered data.

    more precisely I need do some action in “ready” event based on saved filter (highlight some row). BUT i can’t perform my action on step 3 because filter is undefined on step 3. Perform my actions in step 6 is also bad idea because
    “bindingcomplete” event is not unique.

    Thanks

    loading jqgrid with predefined filter #19697

    Peter Stoev
    Keymaster

    Hi,

    The only way to load a Grid with applied filter is demonstrated here: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/filtering.htm?web.

    Best Regards,
    Peter Stoev

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

    loading jqgrid with predefined filter #19699

    ntaxa
    Member

    thanks, so answer for my question is “no”, provided example also force grid to load data twice.

    thanks

    loading jqgrid with predefined filter #19700

    Peter Stoev
    Keymaster

    Hi,

    Actually, in the sample the data is loaded once and then a filter is applied on the loaded data. For server filtering, the scenario is different because when a filter is applied, a new server call is made to get the filtered data set that will be displayed in the Grid.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    loading jqgrid with predefined filter #19712

    ntaxa
    Member

    yes, thanks again

    In my opinion (humble!!!) event “ready” should be fired after second request is performed.
    because after first request grid is not ready yet.

    I want highlight some row when page is loaded. Best to do it in “ready” event. but if grid is reloaded after 1st ready – it’s have no sense.
    in “bindingcomplete” i also can’t do it because i need highlight only at web page load (once).

    Of course there are dirty ways
    1. define “realready” function and call it only once in second “bindingcomplete” (if grid state are stored in storage) or in first “bindingcomplete” (if grid state are not stored in so, grid will not be reloaded)
    2. play with data source

    I used first way but it look disgusting for me.
    Nut maybe already exists “realready” event and i just overlooked it?

    Thanks

    loading jqgrid with predefined filter #19717

    Peter Stoev
    Keymaster

    Hi ntaxa,

    The “ready” callback is raised when the Grid has loaded the data and displayed it. It is correctly called and does what is expected from it. However, we should add a way to add a predefined filter before the Grid’s loading and we will do it in a future version.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com

    loading jqgrid with predefined filter #19719

    ntaxa
    Member

    thanks!
    one more question (“ready” relevant). there is some event raised when grid is already rendered (i mean when DOM is changed).
    if i am right – bindingcomplete, initialized, and ready – all this functions are called _BEFORE_ DOM is rendered. or i am wrong?

    thanks again.

    loading jqgrid with predefined filter #90236

    BSI@123
    Participant

    See comment on April 21, 2013 from Peter Stoev. Has this been added to the functionality of the JQWidgets? If not, how can I work around this issue and not have the second call to the server? I need a default filter and I don’t want two calls to the server. If this can be done, can you add an example? I am not finding one, and I have been searching. I am on release 4.1.2.

    loading jqgrid with predefined filter #90241

    Peter Stoev
    Keymaster

    Initial filter is available in case the data is loaded at once: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/initialfilter.htm?light. For virtual mode scenarios, server call cannot be avoided.

    Best Regards,
    Peter Stoev

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

    loading jqgrid with predefined filter #90307

    BSI@123
    Participant

    Thank you so much for your response and example. This works great except that it adds 2 “Select All” options in my checkedlist filter. I have a filteritems – a list that I created that is a key value pair. I have filtertype – “checkedlist”, and I have filter – the function like in your example. So how do I remove the double “Select All”?

    loading jqgrid with predefined filter #90320

    Peter Stoev
    Keymaster

    Could you share a jsfiddle.net example with our Grid which demonstrates that behavior?

    Best Regards,
    Peter Stoev

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

    loading jqgrid with predefined filter #90350

    BSI@123
    Participant

    I think it has to do with the showfilterrow being used.
    http://jsfiddle.net/bmcgahee/ofxvLhkk/2/

    This was my first time on jsfiddle, so let me know if you have problems with it. The dropdown list shows 2 of the Select All.

    loading jqgrid with predefined filter #90354

    Peter Stoev
    Keymaster

    There are 2 issues here. One is in the Grid, others in the fiddle. The issue in the Grid will be resolved in the next week’s release. It is the duplicated Select All item when a filter is applied. The issue in the code is that the filter is with “contains”, not “equal” as expected for boolean values like in the checkedlistbox.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.