Hi First create six array collections for six comboboxes which will be data providers for them. I am assuming that there can be change in the collection (sourceCollection) e.g. add/remove etc in mean time and you would like to reflect that too. So first add an event listener on that collecion like:
sourceCollection.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionDataChanged); Then in that case a fucntion collectionDataChanged will be called upon.In that function if change is collection.refresh dont do anything, else update individual combobox data providers: updateOrganizationDataProvider(organizationCollection, newOrganization) updateModelDataProvider() so on..... updateOrganizationDataProvider(ac:ArrayColleciton, obj:object) { if (ac.contains(obj) return esle ac.add(obj) } for other comboboxes addition/deletion will be done same way but that will depend upon selection in previous comboboxes. Also FIlter function can be written keeping in mind the selections in all comboboxes. I hope it helps. companyAC, ModelAC, <mx:Object Company="GM" count="85" Model ='Saab" ModelCount=20 Year="2009" YearCount="10" /> <mx:Object Company="GM" count="85" Model ='Saab" ModelCount=20 Year="2008" YearCount="5" /> <mx:Object Company="GM" count="85" Model ='Saab" ModelCount=20 Year="2007" YearCount="5" /> <mx:Object Company="GM" count="85" Model ='Chevi" ModelCount=20 Year="2009" YearCount="20" /> <mx:Object Company="FORD" count="43" Model ='Focus" ModelCount=10 Year="2009" YearCount="5" /> <mx:Object Company="FORD" count="43" Model ='Focus" ModelCount=10 Year="2008" YearCount="3" /> <mx:Object Company="FORD" count="43" Model ='Focs" ModelCount=10 Year="2007" YearCount="2" /> On Jan 22, 5:02 pm, Varun Bajaj <vb.j...@gmail.com> wrote: > I think if you use xmllist for dataprovider for your comboboxes then you can > easily have chain effect as you said. > > Hope this code snippet may help you. > (replace the values according your requirements) > > var dp1:xmllist = new xmllist(dp0.data.(@field == val)); > dp1.refresh(); > > Varun Bajaj > > On Fri, Jan 22, 2010 at 3:08 PM, Jitendra Jain < > > > > warriorofheavens...@gmail.com> wrote: > > Read about filter function it will be quite helpful. > > > On Fri, Jan 22, 2010 at 4:39 AM, Aviral Sharma > > <aviralmsha...@gmail.com>wrote: > > >> Now, you can provide a dataprovider for combobox (using an > >> arraycollection is better than hardcoding the data). > >> Use filter function to remove duplicates as described in the link: > > >>http://blog.flexexamples.com/2007/08/05/removing-duplicate-items-from... > > >> Here is the code (visit the website link above to see a working > >> example) > > >> <!-- Start Code --> > > >> <?xml version="1.0" encoding="utf-8"?> > >> <!-- > >>http://blog.flexexamples.com/2007/08/05/removing-duplicate-items-from... > >> --> > >> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > >> layout="vertical" > >> verticalAlign="middle" > >> backgroundColor="white" > >> creationComplete="init()"> > > >> <mx:Script> > >> <![CDATA[ > >> private var keys:Object = {}; > > >> /** > >> * Called by the Application container's creationComplete > >> * event handler. This method creates a new Array object > >> * which will be used as a data provider as well as a > >> * filtered view of that array which does not contain > >> * duplicated items. > >> */ > >> private function init():void { > >> /* Create a dummy data source with some semi-random > >> data. */ > >> var arr:Array = []; > >> arr.push({data:1, label:"one"}); > >> arr.push({data:1, label:"one"}); > >> arr.push({data:1, label:"one"}); > >> arr.push({data:1, label:"one"}); > >> arr.push({data:2, label:"two"}); > >> arr.push({data:2, label:"two"}); > >> arr.push({data:2, label:"two"}); > >> arr.push({data:1, label:"one"}); > >> arr.push({data:3, label:"three"}); > >> arr.push({data:3, label:"three"}); > > >> /* Filter the original array and call the > >> removeDuplicates() function on each item > >> in the array. */ > >> var filteredArr:Array = arr.filter(removedDuplicates); > > >> arrColl.source = arr; > >> dedupedArrColl.source = filteredArr; > >> } > > >> /** > >> * This method is used to filter an array so that no > >> * duplicate items are created. It works by first > >> * checking to see if a keys object already contains > >> * a key equal to the current value of the item.data > >> * value. If the key already exists, the current item > >> * will not be readded to the data provider. If the key > >> * does not already exist, add the key to the keys > >> * object and add this item to the data provider. > >> */ > >> private function removedDuplicates(item:Object, idx:uint, > >> arr:Array):Boolean { > >> if (keys.hasOwnProperty(item.data)) { > >> /* If the keys Object already has this property, > >> return false and discard this item. */ > >> return false; > >> } else { > >> /* Else the keys Object does *NOT* already have > >> this key, so add this item to the new data > >> provider. */ > >> keys[item.data] = item; > >> return true; > >> } > >> } > >> ]]> > >> </mx:Script> > > >> <mx:ArrayCollection id="arrColl" /> > >> <mx:ArrayCollection id="dedupedArrColl" /> > > >> <mx:HBox> > >> <mx:VBox> > >> <mx:Label text="Original ({arrColl.length} items):" /> > >> <mx:List dataProvider="{arrColl}" /> > >> </mx:VBox> > >> <mx:VBox> > >> <mx:Label text="Filtered ({dedupedArrColl.length} > >> items):" /> > >> <mx:List dataProvider="{dedupedArrColl}" /> > >> </mx:VBox> > >> </mx:HBox> > > >> </mx:Application> > > >> <!-- End Code --> > > >> On Dec 30 2009, 10:46 am, Kiran Kumar Vasireddy <kiranv...@gmail.com> > >> wrote: > >> > Thanks Safi for your response . If I do this I get duplicate elements in > >> > Mycombox , I want to avoid them. > > >> > Regards > >> > Kiran > > >> > On Sun, Dec 27, 2009 at 10:50 PM, saanaa safi <saanaa.s...@gmail.com> > >> wrote: > >> > > hi kiran, > >> > > i hope below example will help u. try this,i think this is what u r > >> > > expecting. > > >> > > <?xml version="1.0" encoding="utf-8"?> > >> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > >> > > layout="absolute"> > >> > > <mx:ArrayCollection id="myColl"> > > >> > > <mx:Object Company="GM" count="85" Model ="Saab" > >> ModelCount="20" > >> > > Year="2009" YearCount="10" /> > >> > > <mx:Object Company="GM" count="85" Model ="Saab" > >> ModelCount="20" > >> > > Year="2008" YearCount="5" /> > >> > > <mx:Object Company="GM" count="85" Model ="Saab" > >> ModelCount="20" > >> > > Year="2007" YearCount="5" /> > >> > > <mx:Object Company="GM" count="85" Model ="Chevi" > >> > > ModelCount="20" Year="2009" YearCount="20" /> > > >> > > <mx:Object Company="FORD" count="43" Model ="Focus" > >> > > ModelCount="20" Year="2009" YearCount="5" /> > >> > > <mx:Object Company="FORD" count="43" Model ="Focus" > >> > > ModelCount="20" Year="2008" YearCount="3" /> > >> > > <mx:Object Company="FORD" count="43" Model ="Focs" > >> > > ModelCount="20" Year="2007" YearCount="2" /> > > >> > > </mx:ArrayCollection> > >> > > <mx:ComboBox prompt="Company" dataProvider="{myColl}" > >> > > labelField="Company" x="44" y="21" width="100"/> > >> > > <mx:ComboBox prompt="Model" dataProvider="{myColl}" > >> labelField="Model" > >> > > x="153" y="21" width="100"/> > >> > > <mx:ComboBox prompt="Year" dataProvider="{myColl}" > >> labelField="Year" > >> > > x="275" y="21" width="100"/> > > >> > > </mx:Application> > > >> > > On Sat, Dec 26, 2009 at 4:00 PM, Kiran Kumar Vasireddy < > >> > > kiranv...@gmail.com> wrote: > > >> > >> Dear All, > > >> > >> I am getting the data in following format . Is there any way to load > >> it > >> > >> into comboxbox avoiding duplicates? First combobox I want to just > >> load > >> > >> Company Name removing duplicates.Second combox box based on the > >> section I > >> > >> have to load Models and In the Thrid combox box based on company and > >> Model > >> > >> I have to load Years.Or if not Arraycollection , I can also get the > >> data in > >> > >> XMLCollection . Could some body please give me best solution? > > >> > >> <ArrayCollection> > > >> > >> <mx:Object Company="GM" count="85" Model ='Saab" > >> ModelCount=20 > >> > >> Year="2009" YearCount="10" /> > >> > >> <mx:Object Company="GM" count="85" Model ='Saab" > >> ModelCount=20 > >> > >> Year="2008" YearCount="5" /> > >> > >> <mx:Object Company="GM" count="85" Model ='Saab" > >> ModelCount=20 > >> > >> Year="2007" YearCount="5" /> > >> > >> <mx:Object Company="GM" count="85" Model ='Chevi" > >> > >> ModelCount=20 Year="2009" YearCount="20" /> > > >> > >> <mx:Object Company="FORD" count="43" Model ='Focus" > >> > >> ModelCount=10 Year="2009" YearCount="5" /> > >> > >> <mx:Object Company="FORD" count="43" Model ='Focus" > >> > >> ModelCount=10 Year="2008" YearCount="3" /> > >> > >> <mx:Object Company="FORD" count="43" Model ='Focs" > >> > >> ModelCount=10 Year="2007" YearCount="2" /> > > >> > >> </ArrayCollection> > > >> > >> -- > >> > >> You received this message because you are subscribed to the Google > >> Groups > >> > >> "Flex India Community" group. > >> > >> To post to this group, send email to flex_in...@googlegroups.com. > >> > >> To unsubscribe from this group, send email to > >> > >> flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com> > >> <flex_india%2bunsubscr...@googlegrou ps.com> > >> > >> . > >> > >> For more options, visit this group at > >> > >>http://groups.google.com/group/flex_india?hl=en. > > >> > > -- > >> > > Warm Regards > >> > > Saanaa.... > > >> > > -- > >> > > You received this message because you are subscribed to the Google > >> Groups > >> > > "Flex India Community" group. > >> > > To post to this group, send email to flex_in...@googlegroups.com. > >> > > To unsubscribe from this group, send email to > >> > > flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com> > >> <flex_india%2bunsubscr...@googlegrou ps.com> > >> > > . > >> > > For more options, visit this group at > >> > >http://groups.google.com/group/flex_india?hl=en. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Flex India Community" group. > >> To post to this group, send email to flex_in...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/flex_india?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Flex India Community" group. > > To post to this group, send email to flex_in...@googlegroups.com. > > To unsubscribe from this group, send email to > > flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/flex_india?hl=en.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.