[flexcoders] Re: Data Binding Issue
Hi, My Requirement is the developer can either pass a list of selected items or not. If he does, then I need to select the check boxes after it's creation. That's the reason I have the code: selected={ selectedItems.contains(chkRepeater.currentItem) } which will select the checkboxes if there were any in the selectedItems Hope this helps.. Thanks, Madhu --- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Friday 23 Mar 2007, madhukiranm wrote: mx:Tile id=chkTile mx:Repeater id=chkRepeater dataProvider={dataItems} mx:CheckBox id=chkCheckBox selected=selectedItems.contains(chkRepeater.currentItem) Not selected={ selectedItems.contains(chkRepeater.currentItem) } ? -- Tom Chiverton Helping to advantageously seize frictionless materials On: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com.
[flexcoders] Re: Data Binding Issue
Hi Tom, Here is the code for the custom component. It contains two arraylists. dataItems and selectedItems. dataItems is the complete set of list for which the check boxes should be generated. selectedItems is the list which has the items (checkboxes) to be selected. The user will send a list of completeList of items (dataItems) and a selected list of items from the main MXML. //Code for the Custom Component ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml width=100% autoLayout=false horizontalScrollPolicy=off verticalScrollPolicy=off creationComplete=initComp() mx:Script ![CDATA[ import mx.collections.ArrayCollection= new ArrayCollection(); [Bindable] public var dataItems:ArrayCollection = new ArrayCollection(); [Bindable] public var selectedItems:ArrayCollection; ]] /mx:Script mx:Tile id=chkTile mx:Repeater id=chkRepeater dataProvider={dataItems} mx:CheckBox id=chkCheckBox selected=selectedItems.contains(chkRepeater.currentItem) label={chkRepeater.currentItem.label} styleName=glass uid={chkRepeater.currentItem.value} / /mx:Repeater /mx:Tile /mx:Canvas //Code for the Main MXML ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=initComp() xmlns:view=view.* mx:Script ![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var completeList:ArrayCollection = new ArrayCollection(); [Bindable] private var selectedList:ArrayCollection; private function initComp(){ //Assume that I will get a list of Items (checkBoxes in this case) to be created completeList = .. } ]] /mx:Script view:MultipleOptionsCheckBoxView dataItems={completeList} selectedItems={selectedList}/ /mx:Application I am binding completeList to dataItems and selectedList to selectedItems. My ultimate goal is, if the developer passes a list of selectedList then the checkboxes should be selected (after creation) based on the items the developer passed. If the developer doesn't pass anything, then when ever a user selects a list of items, they should be available to the developer in the local variable selectedList (as there is a binding). I think you understoood my requirement. Everything works fine for me except when the selectedList (local variable in the Main.mxml) is not initialized. If I initialize this local variable, then the binding works fine (both sides). If I have a list of selectedList, then also the binding works. The only problem is when the selectedList is null. If I initialize the variable in the custom component (when it is null) the binding fails. I dont want to use mx:Binding tag (which also works fine in all situations)... Let me know if I miss anythingor confused you a lot.. Once again, thanks for your help Madhu --- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Friday 23 Mar 2007, madhukiranm wrote: Thanks for the replyI tried the one you suggested, but binding doesn't seem to work. Guess you'll have to post your code then :-) -- Tom Chiverton Helping to administratively entrench interactive convergence On: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com.
[flexcoders] Re: Constant Variable declaration in Custom Component
Got It... Thanks, Madhu --- In flexcoders@yahoogroups.com, madhukiranm [EMAIL PROTECTED] wrote: Hi, I need to declare a constant public variable in a custom component (say direction with values horizontal and vertical). When I use this custom component in any MXML, and try to assign the value for direction, it should give me the values horizontal and vertical so that the user selects one of them. Has anyone implemented this? Any help would be greatly appreciated. Thanks, Madhu
[flexcoders] Re: Data Binding Issue
Thanks for the replyI tried the one you suggested, but binding doesn't seem to work. Thanks, Madhu --- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Tuesday 20 Mar 2007, madhukiranm wrote: [Bindable] tag before the declaration of the variable (in both MXML and Custom Component). Everything works fine except when the variable In the custom component, have you given it a default value, eg: [Bindable] public var myCollection:ArrayCollection=new ArrayCollection() -- Tom Chiverton Helping to widespreadedly differentiate scalable platforms On: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com.
[flexcoders] Constant Variable declaration in Custom Component
Hi, I need to declare a constant public variable in a custom component (say direction with values horizontal and vertical). When I use this custom component in any MXML, and try to assign the value for direction, it should give me the values horizontal and vertical so that the user selects one of them. Has anyone implemented this? Any help would be greatly appreciated. Thanks, Madhu
[flexcoders] Data Binding Issue
Hi, I had a requirement where a variable (ArrayCollection) in a MXML should be binded to a variable (ArrayCollection) in the Custom Component. So, that means when the variable in MXML changes, the one in Custom component should also change and vice versa. I am using [Bindable] tag before the declaration of the variable (in both MXML and Custom Component). Everything works fine except when the variable in the MXML is null and trying to initialize it in the custom component, the binding fails. The binding works fine if I use mx:Binding metatag. But I don't want to use it as each and every developer should declare this in their correspoding MXML's. Is there any better way to handle this situation? Any help is greatly appreciated. Thanks, Madhu