Jun 28, 2013, 7:44 PM
[CLOSED] store.filter method is not working
Hello,
I am trying to use the "filter" method to filter out my Store's data. The code I am using is:
Below is my entire code:
I am trying to use the "filter" method to filter out my Store's data. The code I am using is:
App.stLocation.filter('Divname', new RegExp('^' + value + '$'));
Can you please tell me what I am doing wrong? Thank you very much. Below is my entire code:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script type="text/javascript">
// *********************************** Product Filtering ***********************************
var keyUpProductHandler = function (field, e) {
var value = field.getValue();
App.stLocation.filter('Divname', new RegExp('^' + value + '$'));
}
</script>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.stLocation.DataSource = new object[]
{
new object[] { "12345 - 3m Co", 12345},
new object[] { "29345 - Alcoa Inc",29345},
new object[] { "28345 - Altria Group Inc", 28345 },
new object[] { "American Express Company", 27345 },
new object[] { "American International Group, Inc.", 26345},
new object[] { "AT&T Inc.", 312345},
new object[] { "Boeing Co.", 25345},
new object[] { "Caterpillar Inc.", 24345 },
new object[] { "Citigroup, Inc.", 232345},
new object[] { "E.I. du Pont de Nemours and Company", 222345},
new object[] { "Exxon Mobil Corp", 212345 },
new object[] { "General Electric Company", 192345},
new object[] { "General Motors Corporation", 182345 },
new object[] { "Hewlett-Packard Co.", 172345 },
new object[] { "Honeywell Intl Inc", 162345},
new object[] { "Intel Corporation", 152345 },
new object[] { "International Business Machines", 142345 },
new object[] { "Johnson & Johnson", 132345},
new object[] { "JP Morgan & Chase & Co", 12345 },
new object[] { "McDonald\"s Corporation", 112345 },
new object[] { "Merck & Co., Inc.", 102345 },
new object[] { "Microsoft Corporation", 92345 },
new object[] { "Pfizer Inc", 82345 },
new object[] { "The Coca-Cola Company", 72345},
new object[] { "The Home Depot, Inc.", 62345},
new object[] { "The Procter & Gamble Company", 52345 },
new object[] { "United Technologies Corporation",42345 },
new object[] { "Verizon Communications", 32345 },
new object[] { "Wal-Mart Stores, Inc.", 22345 }
};
this.stLocation.DataBind();
}
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Store Filter</title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel runat="server" Title="Store Filter test">
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:ToolbarTextItem ID="ToolbarTextItem1" runat="server" Text="Find:" />
<ext:TriggerField ID="productFilterField" runat="server" EnableKeyEvents="true">
<Triggers>
<ext:FieldTrigger Icon="Clear" Qtip="Clear filter" />
</Triggers>
<Listeners>
<KeyUp Fn="keyUpProductHandler" />
</Listeners>
</ext:TriggerField>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:Container ID="conLocation" runat="server">
<Items>
<ext:MultiSelect ID="lstProducts" runat="server" Height="130" DisplayField="Divname"
ValueField="LocationKey" AutoDataBind="true" Width="300">
<Store>
<ext:Store ID="stLocation" runat="server">
<Model>
<ext:Model ID="mdLocation" runat="server">
<Fields>
<ext:ModelField Name="Divname" Type="String" />
<ext:ModelField Name="LocationKey" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:MultiSelect>
</Items>
</ext:Container>
</Items>
</ext:Panel>
</form>
</body>
</html>
Last edited by Baidaly; Jul 01, 2013 at 8:25 PM.
Reason: [CLOSED]