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.