This content has been marked as final. Show 3 replies
Whenever you click a row in a DataGrid several events are fired. One is the itemClick event:
<mx:DataGrid itemClick="handleAgentClick(event)" ... >
The event parameter tells you the row and column of the click which lets you know which "agent" the user picked. Now that you have that information you can use that to change the Collection of the ticket's grid to display just that argent's tickets.
Check out these topics in the Flex 2 docs:
* itemClick event (DataGrid)
* filterFunction (Collections)
Your filterFunction can look at a variable in the <mx:Script> block that you set from within the function that handles the itemClick on the agent DataGrid. Once that variable is set, call the ticket dataProvider's refresh function and the ticket grid will then show only those tickets that the filterFunction allows.
Thank you Peter. I'll research these suggestions and look for example code since I'm new to AS. Sounds like a pretty slick solution without having to go back to the CFC with the agentid and re-run the ticket query.
I appreciate the response very much.
Well...the flex docs lang ref isn't too helpful for someone new to AS...at least for those that learn by example.
Anyone have some basic example code of filterFunction in action. I'm using RemoteObject to populate the Grid with tickets in initapp(). Then wanting to filter by agent name.
There is an example code that I'd like to get working with my Grid
Category: USING DATA
Entries: DATA FILTERING
I tried modify this code to talk to a datagrid that is populated by a remoteobject query, instead of the static
that is used in this example.
Had trouble uderstanding what to change all the "mydata" references to so that it points to my ticketgrid results instead of the static arraycollection.
Or do I somehow make my CFGRID remote object build an <mx:ArrayCollection id="myCFCdata"> or something like that??
Again, this is a learning exercise to understand how AS works in relation to a ColdFusion CFC remoteobject. I need to understand the "flow" and "positioning" of the code.
Once I learn this piece, then I'll try the filter with a LIST container picking the agent from a list instead of typing their name in this example.