jQuery UI Widgets Forums Grid Filters the data

Tagged: , ,

This topic contains 1 reply, has 2 voices, and was last updated by  TP_DTNA 8 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Filters the data #80758

    Venki7092
    Participant

    I have 2 pages in my application in 1st page i have a grid in that grid i have anchor tag when i click on that it will be redirected to 2nd page in second page i have back button when we click on that it will redirected to 1st page but all filters which applied are removed so i am planning to getfilters and store in a variable and apply filters after pages is reload .So how can i get filtered list and sorting listof a grid

    Filters the data #80822

    TP_DTNA
    Participant

    I was having this exact same problem, and the best solution that works reliably for me is to never change the source property on the grid, such as $(‘#grid’).jqxGrid(‘source’,dataApater); That will internally call updatebounddata() without preserving the sort and filter. This is true even if you are using autoloadstate, in which case it will restore everything *except* sort and filter (like column width, name, order, visibility, paging, etc).

    So that means I’m left with initializing the grid with a known data source the first time I need it, and then using $(grid).jqxGrid(‘updatebounddata’,’sort’,’filter’); This is not especially clear from the documentation: “You can pass ‘filter’ or ‘sort’ as parameter, if the update reason is change in ‘filtering’ or ‘sorting’.” <- I do this every time because the users expect their sorts and filters to stay right where they left them, and there’s no case where I don’t want this.

    I used to initialize the grids separately, then simply call .jqxGrid(‘source’, data) when the user wanted fresh data, and my code was neat and sensible. But the one problem is that will reliably lose my sorts and filters. So now I have to put in extra code to see if it’s being used for the first time or not, then initialize or update depending on which. I think discarding two arbitrary properties of the grid state with autoload is a bug, but I still love the jqWidgets for being extremely useful and helpful for what I need.

    Here’s my post about this: http://www.jqwidgets.com/community/topic/losing-sort-and-filter-with-autoloadstate/

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

You must be logged in to reply to this topic.