View Full Version : [CLOSED] Retaining grid filter on cell editing

Oct 07, 2014, 2:31 PM

I am loading a grid and saving the data on cell edit. I have been doing this with the help of this example "Editable GridPanel With Save To [DirectMethod]". I also have filter headers tof ilter data. When I filter the data and then change a column value, the grid saves the cell changes and loads removing the filter conditions. Is there a way to retain the filters/sorting even after the grid is loaded after save.

Oct 08, 2014, 2:36 PM
Hi @vmehta,

Do you use local sorting and filtering? If so, you should save the sort and filtering state before saving and restore it after.

For example, you can retrieve currently applied sorters:


Then I would try to re-apply it using a Store's sort method.

Oct 09, 2014, 10:44 AM
Yes, I am using local filters and sorters. There is no issue with the sorters. Even without saving sorters, it gets sorted after editing.
Is there a way to get the filters before editing and then apply them?

Oct 09, 2014, 2:18 PM
Here is the sample of how I do filtering. When data is filtered and then a cell is edited, the grid is refreshed and filter is removed.
All the records without filter is loaded.

<%@ Page Language="C#" %>

<%@ Import Namespace="System.Collections.Generic" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
public class Company
public int ID { get; set; }
public string Name { get; set; }
public double Price { get; set; }

protected void Page_Load(object sender, EventArgs e)
if (!X.IsAjaxRequest)

private void BindData()
Store store = this.GridPanel1.GetStore();
store.DataSource = this.GetData();

private List<Company> GetData()
DateTime today = DateTime.Today;

return new List<Company>
new Company { ID = 1, Name = "3m Co", Price = 71.72 },
new Company { ID = 2, Name = "Alcoa Inc", Price = 29.01},
new Company { ID = 3, Name = "Altria Group Inc", Price = 83.81},
new Company { ID = 4, Name = "American Express Company", Price = 52.55},
new Company { ID = 5, Name = "American International Group, Inc.", Price = 64.13},
new Company { ID = 6, Name = "AT&T Inc.", Price = 31.61},
new Company { ID = 7, Name = "Boeing Co.", Price = 75.43},


[DirectMethod(Namespace = "CompanyX")]
public void Edit(int id, string field, string oldValue, string newValue, object customer)

<!DOCTYPE html>
<head id="Head1" runat="server">
<title>Editor with DirectMethod - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />

var edit = function (editor, e) {

if (!(e.value === e.originalValue || (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
CompanyX.Edit(e.record.data.ID, e.field, e.originalValue, e.value, e.record.data);
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<ext:Model ID="Model1" runat="server" IDProperty="ID">
<ext:ModelField Name="ID" Type="Int" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Price" Type="Float" />

<ColumnModel ID="ColumnModel1" runat="server">
<ext:Column ID="Column1" runat="server" Text="ID" DataIndex="ID" Width="35" />
<ext:Column ID="Column2" runat="server" Text="Name" DataIndex="Name" Flex="1">
<ext:TextField ID="TextField1" runat="server" />
<ext:Column ID="Column3" runat="server" Text="Price" DataIndex="Price">
<Renderer Format="UsMoney" />
<ext:NumberField ID="NumberField1" runat="server" />

<ext:CellSelectionModel ID="CellSelectionModel1" runat="server" />
<ext:CellEditing ID="CellEditing1" runat="server" ClicksToEdit="1">
<Edit Fn="edit" />
<ext:FilterHeader ID="FilterHeader1" runat="server" />


Oct 09, 2014, 7:40 PM
Thank you for the test case.

Please try this.

[DirectMethod(Namespace = "CompanyX")]
public void Edit(int id, string field, string oldValue, string newValue, object customer)