RE: [flexcoders] ComboBox selectedIndex revisited
You have a lot of stuff happening in there. Did you debug it to see why it was not working? Particularly the computeSelectedDateRangeIndex() function? Was it being called when you expected? Tracy Spratt Lariat Services Flex development bandwidth available From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Richard Rodseth Sent: Monday, January 26, 2009 4:46 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] ComboBox selectedIndex revisited I see there was another long thread about this problematic component back in October (Dan Pride) I don't see why this shouldn't work: mx:ComboBox id=dateRangePresetCombo dataProvider={this.availableRanges} selectedIndex={this.computeSelectedDateRangeIndex(this.selectedDateRang ePreset, this.availableRanges)} rowCount={availableRanges.length} labelFunction=labelFunction change=onDateRangePresetSelected(event) / where selectedDateRangeIndex() scans the available ranges, and this.selectedDateRangePreset and this.availableRanges are bindable. But it doesn't. When the component is first created, the combobox appears with the first item selected (sometimes). I believe Dan's workaround involved callLater(). I just had some success with the following: mx:ComboBox id=dateRangePresetCombo dataProvider={this.availableRanges} selectedIndex={this.computeSelectedIndex(this.selectedDateRangePreset, this.availableRanges)} rowCount={availableRanges.length} labelFunction=labelFunction added=onComboBoxCreation(event) change=onDateRangePresetSelected(event) / where on onComboBoxCreation() calls computeSelectedIndex() and sets dateRangePresetCombo.selectedIndex. Doing it on creationComplete rather than added results in flicker as the item changes from item1, but using the added event seems to do the trick. I'm pretty sure there's a bug in ComboBox. Probably not invalidating properties or the display list when it should. Hope this helps someone, and please set me straight if I'm wrong.
Re: [flexcoders] comboBox selectedIndex
If you know what index (n) you want to set it to, comboBox.selectedIndex = n; Adrian Gökhan wrote: How can i change the selectedIndex of a comboBox ? The selectedIndex is get 0 in any case. isn't it writeable ?
RE: [flexcoders] ComboBox SelectedIndex HELP!
Binding to functions is tricky. It doesn't know when its value changed. Binding to something that does is better. The function probably gets run at init time and errors which is eaten by Binding then never knows that the results came back. I would set selectedIndex in the results handler. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of hammer995 Sent: Monday, September 17, 2007 2:51 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] ComboBox SelectedIndex HELP! So I have an edit form which I have several combobox's that I can populate successfully from static arrays. So I want to duplicate this with results from an HTTPService. For some reason, the selectedIndex property does not run the function for selecting the data to be shown by default. The HTTPService gets launched at creationComplete when the user selects the edit component. I actually never get the trace in the findIndexAcct so that leads me to believe that it never gets executed. This is my code: !-- COMBO BOX -- mx:ComboBox id=acctComboBox width=115 dataProvider={getAcctListOnly.lastResult.customers.customer} close=selectedItemAcct=ComboBox(event.target).selectedItem openDuration=500 openEasingFunction=Bounce.easeOut closeDuration=500 closeEasingFunction=Bounce.easeIn selectedIndex={findIndexAcct(data.acct)} alternatingItemColors=[0xDFDFDF, 0xEE] labelField=acct cornerRadius=5/ !-- FUNCTION -- [Bindable] public var acctArray:ArrayCollection; private function getAcctListResultHandler(event:ResultEvent): void { acctArray = event.result.customers.customer as ArrayCollection; /* for (var i:int = 0; i acctArray.length; i++) { trace(acctArray[i].acct); } */ } private function findIndexAcct(acct:String):int { var index:int = -1; for (var i:int = 0; i acctArray.length; i++) { if ( acct == acctArray[i].acct) { index = i; } } trace(index); return index; }
Re: [flexcoders] ComboBox, selectedIndex property
Hi Valy That's perfect scense of use, the selectedItem claims to use to select some values into the array of binded component and in other hands selectedIndex it's to select the first item of this component. You don't have to do much more if you can do this into a function then you will need to use the creationComplete Property. Best. On 2/8/07, Valy Sivec [EMAIL PROTECTED] wrote: If I declare mx:ComboBox id =cb selectedIndex=-1 dataProvider={dp} and have the data provider populated, it seems that the first row from the dataprovider shows as selected; if I do cb.selectedIndex = -1 on creation complete event of the main app it works as expected. Am I missing something here? Regards, Valy -- Expecting? Get great news right away with email Auto-Check.http://us.rd.yahoo.com/evt=49982/*http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html Try the Yahoo! Mail Beta.http://us.rd.yahoo.com/evt=49982/*http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html -- Igor Costa www.igorcosta.org www.igorcosta.com skype: igorpcosta
Re: [flexcoders] ComboBox, selectedIndex property
Thanks for the answer, it's clear now, the API is very clear in this regard, but haven't checked before posting the question... my bad. Valy - Original Message From: Igor Costa [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, February 8, 2007 5:23:01 AM Subject: Re: [flexcoders] ComboBox, selectedIndex property Hi Valy That's perfect scense of use, the selectedItem claims to use to select some values into the array of binded component and in other hands selectedIndex it's to select the first item of this component. You don't have to do much more if you can do this into a function then you will need to use the creationComplete Property. Best. On 2/8/07, Valy Sivec valysivec27@ yahoo.com wrote: If I declare mx:ComboBox id =cb selectedIndex=-1 dataProvider={dp} and have the data provider populated, it seems that the first row from the dataprovider shows as selected; if I do cb.selectedIndex = -1 on creation complete event of the main app it works as expected. Am I missing something here? Regards, Valy Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. -- - --- Igor Costa www.igorcosta. org www.igorcosta. com skype: igorpcosta !-- #ygrp-mlmsg {font-size:13px;font-family:arial,helvetica,clean,sans-serif;} #ygrp-mlmsg table {font-size:inherit;font:100%;} #ygrp-mlmsg select, input, textarea {font:99% arial,helvetica,clean,sans-serif;} #ygrp-mlmsg pre, code {font:115% monospace;} #ygrp-mlmsg * {line-height:1.22em;} #ygrp-text{ font-family:Georgia; } #ygrp-text p{ margin:0 0 1em 0; } #ygrp-tpmsgs{ font-family:Arial; clear:both; } #ygrp-vitnav{ padding-top:10px; font-family:Verdana; font-size:77%; margin:0; } #ygrp-vitnav a{ padding:0 1px; } #ygrp-actbar{ clear:both; margin:25px 0; white-space:nowrap; color:#666; text-align:right; } #ygrp-actbar .left{ float:left; white-space:nowrap; } .bld{font-weight:bold;} #ygrp-grft{ font-family:Verdana; font-size:77%; padding:15px 0; } #ygrp-ft{ font-family:verdana; font-size:77%; border-top:1px solid #666; padding:5px 0; } #ygrp-mlmsg #logo{ padding-bottom:10px; } #ygrp-vital{ background-color:#e0ecee; margin-bottom:20px; padding:2px 0 8px 8px; } #ygrp-vital #vithd{ font-size:77%; font-family:Verdana; font-weight:bold; color:#333; text-transform:uppercase; } #ygrp-vital ul{ padding:0; margin:2px 0; } #ygrp-vital ul li{ list-style-type:none; clear:both; border:1px solid #e0ecee; } #ygrp-vital ul li .ct{ font-weight:bold; color:#ff7900; float:right; width:2em; text-align:right; padding-right:.5em; } #ygrp-vital ul li .cat{ font-weight:bold; } #ygrp-vital a { text-decoration:none; } #ygrp-vital a:hover{ text-decoration:underline; } #ygrp-sponsor #hd{ color:#999; font-size:77%; } #ygrp-sponsor #ov{ padding:6px 13px; background-color:#e0ecee; margin-bottom:20px; } #ygrp-sponsor #ov ul{ padding:0 0 0 8px; margin:0; } #ygrp-sponsor #ov li{ list-style-type:square; padding:6px 0; font-size:77%; } #ygrp-sponsor #ov li a{ text-decoration:none; font-size:130%; } #ygrp-sponsor #nc { background-color:#eee; margin-bottom:20px; padding:0 8px; } #ygrp-sponsor .ad{ padding:8px 0; } #ygrp-sponsor .ad #hd1{ font-family:Arial; font-weight:bold; color:#628c2a; font-size:100%; line-height:122%; } #ygrp-sponsor .ad a{ text-decoration:none; } #ygrp-sponsor .ad a:hover{ text-decoration:underline; } #ygrp-sponsor .ad p{ margin:0; } o {font-size:0;} .MsoNormal { margin:0 0 0 0; } #ygrp-text tt{ font-size:120%; } blockquote{margin:0 0 0 4px;} .replbq {margin:4;} -- TV dinner still cooling? Check out Tonight's Picks on Yahoo! TV. http://tv.yahoo.com/
Re: [flexcoders] combobox selectedIndex
Title: Mercury Email Signature Shlomi, There's nothing wrong with the code that you have posted below. Only reason why I think this would not work is if you have only 2 items in the ComboBox! If not, try this as well mx:ComboBox id="intervalCMB"dataProvider="{intervals}" initialize="intervalCMB.selectedIndex="2" / Sree Shlomi Cohen wrote: Hi Does anyone know how to set an initial selected index on a Combo (for edit dialog for example) i have tried this code and it doesn't work . mx:ComboBox id="intervalCMB"dataProvider="{intervals}" selectedIndex="2" / thanks Shlomi __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
RE: [flexcoders] combobox selectedIndex
Title: Mercury Email Signature Shlomi, One possibility is that you are setting the index of the combobox before the databinding fires. Thus: 1. It attempts to set the index to 2. 2. It sees the dataprovider has length 0. 3. It silently fails at runtime. some time goes by 4. The dataprovider is populated by databinding. You might want to try this: private function getMySelectedIndex(intervals:Object):Number { return(2); } mx:ComboBox id="intervalCMB"dataProvider="{intervals}"selectedIndex="{getMySelectedIndex(intervals)}"/ When 'intervals' changes it fires off a call to the local function getMySelectedIndex via databinding. HTH, Allen Allen Manning, Technical Director Prismix Ltd t: +44 (0)870 749 1100 f: +44 (0)870 749 1200 w: www.prismix.com From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sreejith UnnikrishnanSent: 17 May 2005 14:34To: flexcoders@yahoogroups.comSubject: Re: [flexcoders] combobox selectedIndex Shlomi,There's nothing wrong with the code that you have posted below.Only reason why I think this would not work is if you have only 2 items in the ComboBox!If not, try this as wellmx:ComboBox id="intervalCMB"dataProvider="{intervals}" initialize="intervalCMB.selectedIndex="2" /SreeShlomi Cohen wrote: Hi Does anyone know how to set an initial selected index on a Combo (for edit dialog for example) i have tried this code and it doesn't work . mx:ComboBox id="intervalCMB"dataProvider="{intervals}" selectedIndex="2" /thanks Shlomi__This email has been scanned by the MessageLabs Email Security System.For more information please visit http://www.messagelabs.com/email __ Yahoo! Groups Links To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/ To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.