Nov 15, 2013, 2:51 PM
[CLOSED] Filtering a store with a ModelField of Type Object
I have a DataView that I want to apply a filter on. The Filter has a store that has two ModelFields, one is a string which I can filter by easily the other is of type object that I cannot figure out how to apply a filter on. How do I access the properties of an Object to apply a filter?
This will work because the filter property is a string type
Full Code
This will work because the filter property is a string type
<ext:TextField runat="server" FieldLabel="Filter" Width="250" LabelAlign="Right" LabelWidth="35">
<Listeners>
<Change Handler="var dataview = Ext.getCmp('AppDataView'), store = dataview.store;
store.suspendEvents();
store.clearFilter();
dataview.getSelectionModel().clearSelections();
store.resumeEvents();
store.filter({
property: 'Letter',
anyMatch: true,
value: newValue
});" Buffer="50" />
</Listeners>
</ext:TextField>
This will not work becuse the property is of type object<ext:TextField runat="server" FieldLabel="Filter" Width="250" LabelAlign="Right" LabelWidth="35">
<Listeners>
<Change Handler="var dataview = Ext.getCmp('AppDataView'), store = dataview.store;
store.suspendEvents();
store.clearFilter();
dataview.getSelectionModel().clearSelections();
store.resumeEvents();
store.filter({
property: 'Applications[ApplicationName]',
anyMatch: true,
value: newValue
});" Buffer="50" />
</Listeners>
</ext:TextField>
Full Code
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Text="Print" Icon="Printer" OnClientClick="window.print();" />
<ext:TextField runat="server" FieldLabel="Filter" Width="250" LabelAlign="Right" LabelWidth="35">
<Listeners>
<Change Handler="var dataview = Ext.getCmp('AppDataView'), store = dataview.store;
store.suspendEvents();
store.clearFilter();
dataview.getSelectionModel().clearSelections();
store.resumeEvents();
store.filter({
property: 'Applications[ApplicationName]',
anyMatch: true,
value: newValue
});" Buffer="50" />
</Listeners>
</ext:TextField>
</Items>
</ext:Toolbar>
<form id="form1" runat="server">
<div>
<ext:DataView runat="server" DisableSelection="true" ItemSelector="td.letter-row" EmptyText="" ID="AppDataView">
<Store>
<ext:Store ID="Tier1Applications" runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Letter" />
<ext:ModelField Name="Applications" Type="Object" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Tpl ID="Template1" runat="server">
<Html>
<div id="applications-am">
<div class="header">
<p>Asset Management Applications</p>
</div>
<table>
<tr>
<th style="width:40%">Application Name</th>
<th style="width:20%">Acronym</th>
<th style="width:20%">Line of Business</th>
<th style="width:20%">Contact</th>
</tr>
<tpl for=".">
<tr>
<td class="letter-row" colspan="4">
<div><h2 class="letter-selector">{Letter}</h2></div>
<tpl for="Applications">
<table>
<tr class="applicaiton-record">
<td class="application-name" appName="{ApplicationName}" appAcronym="{ApplicationAcronym}" appLob="{ApplicationLob}" appContact="{ApplicationContact}" appEmail="{ApplicationEmail}" appDoc="{ApplicationDocUrl}" style="width:40%">{ApplicationName}</td>
<td style="width:20%"> {ApplicationAcronym}</td>
<td style="width:20%"> {ApplicationLob}</td>
<td style="width:20%"> {ApplicationContact}</td>
</tr>
</table>
</tpl>
</td>
</tr>
</tpl>
</table>
</div>
</Html>
</Tpl>
<Listeners>
<ItemClick Fn="itemClick" />
<Refresh Handler="this.el.select('tr.applicaiton-record').addClsOnOver('cust-name-over');" Delay="100" />
</Listeners>
</ext:DataView>
</div>
</form>
Last edited by Daniil; Nov 22, 2013 at 4:08 AM.
Reason: [CLOSED]