PDA

View Full Version : [CLOSED] ListFilter values



cwolcott
Mar 23, 2012, 12:53 PM
When I specify "Options" for the ListFilter can I also provide the values I want returned (e.g., "D", "C", "F") or am I stuck with "Dog", "Cat", "Fish" as the return values.




<ext:GridFilters ID="ActiveUsersFilters" runat="server" >
<Filters>
<ext:ListFilter DataIndex="AnimalNm" Options="Dog, Cat, Fish" />
</Filters>
</ext:GridFilters>

Daniil
Mar 23, 2012, 1:37 PM
Hi,

You should use the ListFilter GetValue.

Example

<ext:ListFilter DataIndex="animal" Options="Dog, Cat, Fish">
<GetValue Handler="var selected = this.menu.getSelected(); // this is returned by default
// transform the selected array as you need
return selected;" />
</ext:ListFilter>

cwolcott
Mar 23, 2012, 3:41 PM
OK, this works for me. Thanks ...



<ext:ListFilter DataIndex="animal" Options="Dog, Cat, Fish">
<GetValue Handler="var selected = this.menu.getSelected();
var newValues = new Array(selected.length);
for (var i in selected) {
switch (selected[i]) {
case 'Dog': newValues[i] = 'D'; break;
case 'Cat': newValues[i] = 'C'; break;
case 'Fish': newValues[i] = 'F'; break;
default: newValues[i] = '';
}
}
return selected;" />
</ext:ListFilter>