We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Saving filtered records from grid

Thread ID:

Created:

Updated:

Platform:

Replies:

123689 Apr 11,2016 05:49 PM UTC Apr 12,2016 12:58 PM UTC ASP.NET Web Forms 1
loading
Tags: Grid
daniel Rossouw
Asked On April 11, 2016 05:49 PM UTC

I have an interesting request from a client and looking at different grid solutions. They want to know if it is possible to filter a grid using excel functionality (yes syncfusion does perfectly) but then save the results for use in a mailing list (my guess it is possible if you unique key but havent tried yet) and then the most interesting question of all. Can that filtered list with all filters etc be saved and restored at a later time if they want to update mailing list (this is pushing all kinds of boundaries but I thought interesting to ask if anyone has come across this question)
So to summarize:
1. User get all records back in grid
2. User creates all kinds of filters and decide the result set is mailing list and save somewhere (must be possible)
3. User decided at later stage to update mailing list but do not want to recreate filters (this one I think not possible but I may be wrong)
DR

Venkatesh Ayothi Raman [Syncfusion]
Replied On April 12, 2016 12:58 PM UTC

Hi Daniel,

Thanks for contacting Syncfusion support.

Query 1: User get all records back in Grid.
Yes, we can get all the records back into grid after filtering using clearFiltering method. Please refer to the code example,
Code example:

function defaultstate() {

    

            var gridObj = $("#MainContent_Grid1").ejGrid("instance");// Create a Grid instance.

            gridObj.clearFiltering();// Remove all the filtered columns and get back in grid.

        }





Query 2: Save the state in somewhere

The filterColumns of the grid will contain the filter state applied to the grid and hence the filterColumns is sufficient to reapply the filter state to the grid.

function saveState() {

  

            var gridObj = $("#MainContent_Grid1").ejGrid("instance")// Create a grid instance.

          

            filtercol = gridObj.model.filterSettings.filteredColumns.slice();// Store a deep copy of filtered details

           

           

  

    }

  
Refer to UG documentation: http://help.syncfusion.com/js/api/ejgrid#members:filtersettings

Query 3: Update a filter records but without recreate a filters.

To re-apply the saved filterColumns(filter criteria) use the following code example,

function applyState(args) {


                

            var gridObj = $("#MainContent_Grid1").ejGrid("instance");


            gridObj.model.filterSettings.filteredColumns = filtercol;//Update the filtered records which is retrieve from save state.


            gridObj.refreshContent();// Refresh the gridContent.

        }


Note: We are able to get the filterRecords by following way,

Code example:

function applyState(args) {


                

            var gridObj = $("#MainContent_Grid1").ejGrid("instance");


                           var filterRecords = gridObj.getFilteredRecords();//Get the collection of filtered records




Refer to the UG documentation: http://help.syncfusion.com/js/api/ejgrid#methods:getfilteredrecords

Regards,
Venkatesh Ayothiraman.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;