Very new to flex - AS
I am trying to take a flash form and convert it to a flex app.
The form has a filter by text box that filters a data grid and a combo box
that selects the column of the data grid to filter. I am having trouble
getting my head around making things happen. I have the grid bringing back
the data as an arrayCollection and I found an example of filtering and have
it working. I am having trouble making the leap to changing the column
programmatically.
Thanks to ASFusion here is the flash form filter
<cfsavecontent variable="actionFilter">
if(_global.arrMembers == undefined) _global.arrMembers =
data.dataProvider.slice(0);
var arrMembers = _global.arrMembers;
var arrDisplay:Array = [];
var fortext = forInput.text.toLowerCase();
var selected = column.selectedItem.data;
for(var i = 0; i < arrMembers.length; i++)
{
if(arrMembers[i][selected].toString().substr(0,fortext.length).toLowerCase()
== fortext)
{
arrDisplay.push(arrMembers[i]);
}
}
data.dataProvider = arrDisplay;
</cfsavecontent>
Here is my filter in Flex
public function filter():void{
memberList.filterFunction=processFilter;
}
// Filter function
public function processFilter(item:Object):Boolean{
var result:Boolean=false;
var fortext:String = filterText.text.toUpperCase();
// If no filter text, or a match, then true
if (item.City.toUpperCase().substr(0,fortext.length) == fortext )
result=true;
return result;
}
The Combo Box example I am using is:
<mx:ComboBox id="filterInput" dataProvider="{cards}" width="130"
close="sI=ComboBox(event.target).selectedItem" />
I have tried using sI.data as a var in the processFilter function but no
luck.
I would appreciate a nudge in the right direction.
Michael Sumner
Nations Best Sports
817-788-0034 ext 244
817-788-8542 fax
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/
www.teksystems.com/