tags:

views:

23

answers:

1

i’m new to RIA, Flex. Currently i’m using Flex 3. I have some difficulty in my work. i have three lists and a button. depending up on the selected items in first two list and after clicking the button i have to disply the items in details list.can any any one help me thanks in advance

in first list iam displaying names of employees in second list displaying managers names then if i select one employee name and one managers name then after clicking button corresponding employee and managers details should be dispplayed in the third list. this is my work presently iam unable to post my code the problem is with initialising the details list and dynamically changing it.

A: 

It sounds like your third "list" isn't going to be a list at all, it will be a DataGrid of some kind, or a form with key/value pairs for the common data each employee and manager share.

Presumably your employee and manager lists are populated from a database, and you get more data than the name with each data object. What you need to do is add an event listener which listens for the change event in each of your first two lists. Then you have an event handler that does something with the result. The following just concatenates all the data from each selectedItem (for our imaginary list1 and list2) and puts it into an ArrayCollection, which is then assigned as the dataProvider for a DataGrid named dg:

private function changeHandler(event:DataGridEvent) : void {
  var list1Item:Object = list1.selectedItem;
  var list2Item:Object = list2.selectedItem;

  var ac:ArrayCollection = new ArrayCollection();

  for (prop in list1Item) {
    ac.addItem({prop:list1Item[prop]});
  }
  for (prop in list2Item) {
    ac.addItem({prop:list2Item[prop]});
  }
  dg.dataProvider = ac;
}

This is obviously not how you are going to do this, but it serves as an example. More likely you will have certain properties that you are interested in showing, and those are the ones you will add to the dg dataProvider.

This is as helpful as I can be speaking generally, in the absence of specific descriptions and requirements.

Robusto
thank you very very much for your answer.it works good
Madhu
OK, then if this answers your question it is customary to click the check mark to accept the answer, or at least upvote it. This raises your acceptance percentage and makes it more likely people will want to answer your questions in the future.
Robusto