PDA

View Full Version : [CLOSED] GridPanel: Set ListFilter on client side



jamesand
Jan 20, 2014, 7:44 PM
Hi, I'm following this thread:

http://forums.ext.net/showthread.php?24762-CLOSED-How-to-set-multiple-values-for-ListFilter-on-the-client

about applying listflter on client side, but it doesn't work for me. Nothing happens. Has it changed the way it has to be done in 2.X?

Thanks in advance.

Daniil
Jan 21, 2014, 5:10 AM
Hi @jamesand,

The setValue and setActive calls appears to be working still.

Example

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

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

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { "test1" },
new object[] { "test2" },
new object[] { "test3" },
};
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET Example</title>

<script type="text/javascript">
var set = function () {
var gridFilters = App.GridPanel1.filters,
listFilter = gridFilters.filters.get(0);

listFilter.setValue(["test1", "test2"]);
listFilter.setActive(true);
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Button runat="server" Text="Set values for ListFilter" Handler="set" />

<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test" DataIndex="test" />
</Columns>
</ColumnModel>
<Features>
<ext:GridFilters runat="server" Local="true">
<Filters>
<ext:ListFilter DataIndex="test" Options="test1, test2, test3" />
</Filters>
</ext:GridFilters>
</Features>
</ext:GridPanel>
</form>
</body>
</html>

jamesand
Jan 21, 2014, 9:21 AM
Hi @jamesand,

The setValue and setActive calls appears to be working still.


Yes it works. It was a issue with a duplicated gridpanel name.

Anyway, the code that works for me is:


var setFiltroHoteles = function () {

var gridFilters = #{grdClientesGrid}.filters,
listFilter = gridFilters.filters.get(1);

listFilter.setValue([3]);
listFilter.setActive(true);
};

Regards.