I would create a [Bindable] instance variable typed as XMLListCollection
and bind the dg.dataProvider to that.

 

Then, in the button handlers, set the bound variable:

var xlFilteredData:XMLList = userXML.(category=='guest');

_xlcData = new XMLListCollection(xlFilteredData);

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of donvoltz
Sent: Tuesday, September 11, 2007 10:21 AM
To: [email protected]
Subject: [flexcoders] Filtering XML best practices

 

Hi Everyone,

I have been using a master XML file containing about 120 usernames 
and additional information. Currently using custom renderers and a 
datagrid, I am displaying all of the users. What I would like to do 
is add buttons along the top of the datgrid to filter this XML into 
4 - 5 different groups based on a category designation in the XML. My 
question about this is what is the best practice way to do this?

Should I create a new XMLListCollection that filters the master list 
for each of the categories or can I add e4x filtering directly into 
the databinding property of the datagrid using actionscript and a 
custom event when one of the "filter" buttons is pressed. I have not 
been able to get this second method to work so I am unsure if this is 
possible.
(this is what I have tried to do in the datagrid tag dataProvider 
= "{userXML.(category=='guest')}")

Thanks for any help and guidance

Sincerely,

Don

 

Reply via email to