[flexcoders] Re: mx:ComboBox Again.
Alert.show(ProcessorName.selectedItem.lastResult) to Alert.show(ProcessorName.selectedItem.id) -TH --- In flexcoders@yahoogroups.com, Jeremy Watson [EMAIL PROTECTED] wrote: Hey Guys, Man this combo thing is pissin me off! Let me ask this simple question first. Is this the correct way of getting data out of the database and into the combobox? What I'm trying to do is just get the ID out of the combobox and alert it. ONCE i get that far I would like to call another function (yet to be created) which will do a remote call and bring in values to bind to a text box based on what was selected from the combo box (can this even be done?). Does that make sense? I would've had this done in about 10 mins in CF and HTMLgod do I miss it. My Example code is below. Any help would be grateful. Jeremy. mx:Script ![CDATA[ import flash.events.Event; import mx.events.DropdownEvent; import mx.collections.ArrayCollection; import com.sml.cows.DrawDown; import com.sml.cows.MyDropDownTCowsR_Processor; import mx.utils.ObjectUtil; import mx.events.FlexEvent; import mx.formatters.NumberBase; import mx.controls.TextArea; import mx.messaging.messages.AcknowledgeMessage; import mx.controls.Alert; //import mx.rpc.remoting.RemoteObject; import mx.utils.ArrayUtil; import mx.rpc.events.ResultEvent; import mx.rpc.Fault; import mx.rpc.events.FaultEvent; import mx.rpc.soap.mxml.WebService; import mx.events.ValidationResultEvent; import mx.events.ItemClickEvent; import mx.events.DropdownEvent; import mx.events.ListEvent public function onCreationComplete( event:FlexEvent):void { remoteService.getProcessors(); } // Display the type of event for open and close events. private function dropEvt(event:DropdownEvent):void { forChange.text+=event.type + \n; } // Display a selected item's label field and index for change events. private function changeEvt(event:Event):void { Alert.show (ProcessorName.selectedItem.lastResult) forChange.text+=event.currentTarget.selectedItem.label + + event.currentTarget.selectedIndex + \n; } ]] /mx:Script mx:RemoteObject id=remoteService destination=ColdFusion source=Cows3.cows showBusyCursor=true/ mx:ComboBox id=ProcessorName change=changeEvt(event) open=dropEvt(event) close=dropEvt(event) dataProvider={remoteService.getProcessors.lastResult} labelField=ProcessorName x=403 y=97 /mx:ComboBox mx:ComboBox open=dropEvt(event) close=dropEvt(event) change=changeEvt(event) mx:ArrayCollection mx:Object label=AL data=Montgomery/ mx:Object label=AK data=Juneau/ mx:Object label=AR data=Little Rock/ /mx:ArrayCollection /mx:ComboBox mx:TextArea id=forChange width=150 height=100%/ /mx:Application Send instant messages to your online friends http://au.messenger.yahoo.com
Re: [flexcoders] Re: mx:ComboBox Again.
Hey Tim, Thanks for that. I tried id then realised that it wouldn't work because I needed to have the id name out of the database i.e. ProcessorID. Then it worked. Thanks again! Jeremy - Original Message From: Tim Hoff [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Saturday, 31 March, 2007 11:00:03 AM Subject: [flexcoders] Re: mx:ComboBox Again. Alert.show(Processo rName.selectedIt em.lastResult) to Alert.show(Processo rName.selectedIt em.id) -TH --- In [EMAIL PROTECTED] ups.com, Jeremy Watson flexjeremy@ ... wrote: Hey Guys, Man this combo thing is pissin me off! Let me ask this simple question first. Is this the correct way of getting data out of the database and into the combobox? What I'm trying to do is just get the ID out of the combobox and alert it. ONCE i get that far I would like to call another function (yet to be created) which will do a remote call and bring in values to bind to a text box based on what was selected from the combo box (can this even be done?). Does that make sense? I would've had this done in about 10 mins in CF and HTMLgod do I miss it. My Example code is below. Any help would be grateful. Jeremy. mx:Script ![CDATA[ import flash.events. Event; import mx.events.DropdownE vent; import mx.collections. ArrayCollection; import com.sml.cows. DrawDown; import com.sml.cows. MyDropDownTCowsR _Processor; import mx.utils.ObjectUtil ; import mx.events.FlexEvent ; import mx.formatters. NumberBase; import mx.controls. TextArea; import mx.messaging. messages. AcknowledgeMessa ge; import mx.controls. Alert; //import mx.rpc.remoting. RemoteObject; import mx.utils.ArrayUtil; import mx.rpc.events. ResultEvent; import mx.rpc.Fault; import mx.rpc.events. FaultEvent; import mx.rpc.soap. mxml.WebService; import mx.events.Validatio nResultEvent; import mx.events.ItemClick Event; import mx.events.DropdownE vent; import mx.events.ListEvent public function onCreationComplete( event:FlexEvent) :void { remoteService. getProcessors( ); } // Display the type of event for open and close events. private function dropEvt(event: DropdownEvent) :void { forChange.text+ =event.type + \n; } // Display a selected item's label field and index for change events. private function changeEvt(event: Event):void { Alert.show (ProcessorName. selectedItem. lastResult) forChange.text+ =event.currentTa rget.selectedIte m.label + + event.currentTarget .selectedIndex + \n; } ]] /mx:Script mx:RemoteObject id=remoteService destination= ColdFusion source=Cows3. cows showBusyCursor= true/ mx:ComboBox id=ProcessorName change=changeEvt( event) open=dropEvt( event) close=dropEvt( event) dataProvider= {remoteService. getProcessors. lastResult} labelField= ProcessorName x=403 y=97 /mx:ComboBox mx:ComboBox open=dropEvt( event) close=dropEvt( event) change=changeEvt( event) mx:ArrayCollection mx:Object label=AL data=Montgomery / mx:Object label=AK data=Juneau / mx:Object label=AR data=Little Rock/ /mx:ArrayCollectio n /mx:ComboBox mx:TextArea id=forChange width=150 height=100% / /mx:Application Send instant messages to your online friends http://au.messenger .yahoo.com !-- #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
[flexcoders] Re: mx:ComboBox Again.
Cool, I knew that you would get. For aomething like this, you can also bypass the change event (if you just need a value) by binding directly: mx:TextArea id=forChange width=150 height=100% text={ ProcessorName.selectedItem.ProcessorID }/ or, whatever field you want. Cheers, -TH --- In flexcoders@yahoogroups.com, Jeremy Watson [EMAIL PROTECTED] wrote: Hey Tim, Thanks for that. I tried id then realised that it wouldn't work because I needed to have the id name out of the database i.e. ProcessorID. Then it worked. Thanks again! Jeremy - Original Message From: Tim Hoff [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Saturday, 31 March, 2007 11:00:03 AM Subject: [flexcoders] Re: mx:ComboBox Again. Alert.show(Processo rName.selectedIt em.lastResult) to Alert.show(Processo rName.selectedIt em.id) -TH --- In [EMAIL PROTECTED] ups.com, Jeremy Watson flexjeremy@ ... wrote: Hey Guys, Man this combo thing is pissin me off! Let me ask this simple question first. Is this the correct way of getting data out of the database and into the combobox? What I'm trying to do is just get the ID out of the combobox and alert it. ONCE i get that far I would like to call another function (yet to be created) which will do a remote call and bring in values to bind to a text box based on what was selected from the combo box (can this even be done?). Does that make sense? I would've had this done in about 10 mins in CF and HTMLgod do I miss it. My Example code is below. Any help would be grateful. Jeremy. mx:Script ![CDATA[ import flash.events. Event; import mx.events.DropdownE vent; import mx.collections. ArrayCollection; import com.sml.cows. DrawDown; import com.sml.cows. MyDropDownTCowsR _Processor; import mx.utils.ObjectUtil ; import mx.events.FlexEvent ; import mx.formatters. NumberBase; import mx.controls. TextArea; import mx.messaging. messages. AcknowledgeMessa ge; import mx.controls. Alert; //import mx.rpc.remoting. RemoteObject; import mx.utils.ArrayUtil; import mx.rpc.events. ResultEvent; import mx.rpc.Fault; import mx.rpc.events. FaultEvent; import mx.rpc.soap. mxml.WebService; import mx.events.Validatio nResultEvent; import mx.events.ItemClick Event; import mx.events.DropdownE vent; import mx.events.ListEvent public function onCreationComplete( event:FlexEvent) :void { remoteService. getProcessors( ); } // Display the type of event for open and close events. private function dropEvt(event: DropdownEvent) :void { forChange.text+ =event.type + \n; } // Display a selected item's label field and index for change events. private function changeEvt(event: Event):void { Alert.show (ProcessorName. selectedItem. lastResult) forChange.text+ =event.currentTa rget.selectedIte m.label + + event.currentTarget .selectedIndex + \n; } ]] /mx:Script mx:RemoteObject id=remoteService destination= ColdFusion source=Cows3. cows showBusyCursor= true/ mx:ComboBox id=ProcessorName change=changeEvt( event) open=dropEvt( event) close=dropEvt( event) dataProvider= {remoteService. getProcessors. lastResult} labelField= ProcessorName x=403 y=97 /mx:ComboBox mx:ComboBox open=dropEvt( event) close=dropEvt( event) change=changeEvt( event) mx:ArrayCollection mx:Object label=AL data=Montgomery / mx:Object label=AK data=Juneau / mx:Object label=AR data=Little Rock/ /mx:ArrayCollectio n /mx:ComboBox mx:TextArea id=forChange width=150 height=100% / /mx:Application Send instant messages to your online friends http://au.messenger .yahoo.com !-- #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
[flexcoders] Re: mx:ComboBox Again.
Let's try this without the typo's. Cool, I knew that you would get it. :) For something like this, you can also bypass the change event (if you just need a value) by binding directly: mx:TextArea id=forChange width=150 height=100% text={ ProcessorName.selectedItem.ProcessorID }/ or, whatever field you want. Cheers, -TH --- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote: Cool, I knew that you would get. For aomething like this, you can also bypass the change event (if you just need a value) by binding directly: mx:TextArea id=forChange width=150 height=100% text={ ProcessorName.selectedItem.ProcessorID }/ or, whatever field you want. Cheers, -TH --- In flexcoders@yahoogroups.com, Jeremy Watson flexjeremy@ wrote: Hey Tim, Thanks for that. I tried id then realised that it wouldn't work because I needed to have the id name out of the database i.e. ProcessorID. Then it worked. Thanks again! Jeremy - Original Message From: Tim Hoff Tim.Hoff@ To: flexcoders@yahoogroups.com Sent: Saturday, 31 March, 2007 11:00:03 AM Subject: [flexcoders] Re: mx:ComboBox Again. Alert.show(Processo rName.selectedIt em.lastResult) to Alert.show(Processo rName.selectedIt em.id) -TH --- In [EMAIL PROTECTED] ups.com, Jeremy Watson flexjeremy@ ... wrote: Hey Guys, Man this combo thing is pissin me off! Let me ask this simple question first. Is this the correct way of getting data out of the database and into the combobox? What I'm trying to do is just get the ID out of the combobox and alert it. ONCE i get that far I would like to call another function (yet to be created) which will do a remote call and bring in values to bind to a text box based on what was selected from the combo box (can this even be done?). Does that make sense? I would've had this done in about 10 mins in CF and HTMLgod do I miss it. My Example code is below. Any help would be grateful. Jeremy. mx:Script ![CDATA[ import flash.events. Event; import mx.events.DropdownE vent; import mx.collections. ArrayCollection; import com.sml.cows. DrawDown; import com.sml.cows. MyDropDownTCowsR _Processor; import mx.utils.ObjectUtil ; import mx.events.FlexEvent ; import mx.formatters. NumberBase; import mx.controls. TextArea; import mx.messaging. messages. AcknowledgeMessa ge; import mx.controls. Alert; //import mx.rpc.remoting. RemoteObject; import mx.utils.ArrayUtil; import mx.rpc.events. ResultEvent; import mx.rpc.Fault; import mx.rpc.events. FaultEvent; import mx.rpc.soap. mxml.WebService; import mx.events.Validatio nResultEvent; import mx.events.ItemClick Event; import mx.events.DropdownE vent; import mx.events.ListEvent public function onCreationComplete( event:FlexEvent) :void { remoteService. getProcessors( ); } // Display the type of event for open and close events. private function dropEvt(event: DropdownEvent) :void { forChange.text+ =event.type + \n; } // Display a selected item's label field and index for change events. private function changeEvt(event: Event):void { Alert.show (ProcessorName. selectedItem. lastResult) forChange.text+ =event.currentTa rget.selectedIte m.label + + event.currentTarget .selectedIndex + \n; } ]] /mx:Script mx:RemoteObject id=remoteService destination= ColdFusion source=Cows3. cows showBusyCursor= true/ mx:ComboBox id=ProcessorName change=changeEvt( event) open=dropEvt( event) close=dropEvt( event) dataProvider= {remoteService. getProcessors. lastResult} labelField= ProcessorName x=403 y=97 /mx:ComboBox mx:ComboBox open=dropEvt( event) close=dropEvt( event) change=changeEvt( event) mx:ArrayCollection mx:Object label=AL data=Montgomery / mx:Object label=AK data=Juneau / mx:Object label=AR data=Little Rock/ /mx:ArrayCollectio n /mx:ComboBox
[flexcoders] Re: mx:ComboBox
--- In flexcoders@yahoogroups.com, flexjeremy [EMAIL PROTECTED] wrote: One last thing if I were getting a value out of the database is there a way to say that item is selected? I've written a class that allows you to data-bind a combo similar to how you bind a text field.. You set the valueField propertie on an instance of this component to the field in the dataProvider that you're using as the data or key field, then you bind the bindableValue property to your dataModel in both directions. So, saw you have a form that you're using to track customer's addresses, and this form is backed by a customerAddress object with properties like city, state, and zipCode. You also have an ArrayCollection with state names and abbreviations - states.stateName and states.stateCode.. You would set the combo's dataProvider to states, and it's labelField to stateName. For the custom properties, you set the valueField property to stateCode, and then two-way bind the bindableValue property to customerAddress.state. Any time the user selects a new state from the combo, the component will update the bindableValue property with the corresponding valueField value - data binding changes it in your model. When the model changes programmatically, eg from the result of a remoting call, data binding will update bindableValue from the model.. The propertyChange event is issued and caught by the component, and it calls code exactly like what's been posted to locate the item with the corresponding key. Code: ?xml version=1.0 encoding=utf-8? mx:ComboBox xmlns:mx=http://www.adobe.com/2006/mxml; change=onChange(event) creationComplete=setup() mx:Script ![CDATA[ import mx.controls.Alert; public var valueField:String; [Bindable] public var bindableValue:Object; private function setup():void { this.addEventListener(propertyChange, selectByValue); } public function onChange(e:Event):void { if (bindableValue != this.selectedItem[valueField]) { bindableValue = this.selectedItem[valueField]; } } public function selectByValue(e:Event):void { for (var i:Number = 0; i this.dataProvider.length; i = i + 1) { if (this.dataProvider[i][this.valueField] == bindableValue) { this.selectedIndex = i; return; } } //If we're still here we got passed a value that's not in the combobox this.selectedIndex = -1; } ]] /mx:Script /mx:ComboBox
[flexcoders] Re: mx:ComboBox
Jeremy, You will need to specify a labelField or labelFunction in order for the ComboBox to know what you want to display. Maury --- In flexcoders@yahoogroups.com, flexjeremy [EMAIL PROTECTED] wrote: Hello helpful list, I seem to be confusing myself. I'm using ColdFusion to get the data out of our database. Simple. I got a remote object getting the data. mx:RemoteObject id=remoteService destination=ColdFusion source=Cows3.cows showBusyCursor=true/ Now what I want to do is firstly get the data into it. I tried this by doing the following. mx:ComboBox id=ProcessorName dataProvider={remoteService.getProcessors.lastResult} /mx:ComboBox Now I know that it needs to be in an Array. When I dump the data into a grid. It works fine. i.e. mx:DataGrid dataProvider={remoteService.getProcessors.lastResult} /mx:DataGrid All the examples on Adobe's site is shitting me. Cause they are put in from an Array they manually make. Help. Again. Jeremy
[flexcoders] Re: mx:ComboBox
Boy do I feel like a dork. Excellent. Thank you. One last thing if I were getting a value out of the database is there a way to say that item is selected? I know how to do this in ColdFusion, but I'm thinking that would be totally different in Flex. SO for example in CF we do it this way. select name=bob id=bob option value=#mybobid# cfif mybobid IS mybobidfromdbselected/cfif#mybob#/option /select In flex we do it..? *insert blank look from jeremy* Jeremy --- In flexcoders@yahoogroups.com, Maury Sword [EMAIL PROTECTED] wrote: Jeremy, You will need to specify a labelField or labelFunction in order for the ComboBox to know what you want to display. Maury --- In flexcoders@yahoogroups.com, flexjeremy flexjeremy@ wrote: Hello helpful list, I seem to be confusing myself. I'm using ColdFusion to get the data out of our database. Simple. I got a remote object getting the data. mx:RemoteObject id=remoteService destination=ColdFusion source=Cows3.cows showBusyCursor=true/ Now what I want to do is firstly get the data into it. I tried this by doing the following. mx:ComboBox id=ProcessorName dataProvider={remoteService.getProcessors.lastResult} /mx:ComboBox Now I know that it needs to be in an Array. When I dump the data into a grid. It works fine. i.e. mx:DataGrid dataProvider={remoteService.getProcessors.lastResult} /mx:DataGrid All the examples on Adobe's site is shitting me. Cause they are put in from an Array they manually make. Help. Again. Jeremy
[flexcoders] Re: mx:ComboBox
Try this: for (var i:Number=0; i bob.dataProvider.length; i++) { if (bob.dataProvider[i].bobid == mybobid) { bob.selectedIndex = i; break; } } --- In flexcoders@yahoogroups.com, flexjeremy [EMAIL PROTECTED] wrote: Boy do I feel like a dork. Excellent. Thank you. One last thing if I were getting a value out of the database is there a way to say that item is selected? I know how to do this in ColdFusion, but I'm thinking that would be totally different in Flex. SO for example in CF we do it this way. select name=bob id=bob option value=#mybobid# cfif mybobid IS mybobidfromdbselected/cfif#mybob#/option /select In flex we do it..? *insert blank look from jeremy* Jeremy --- In flexcoders@yahoogroups.com, Maury Sword maury.sword@ wrote: Jeremy, You will need to specify a labelField or labelFunction in order for the ComboBox to know what you want to display. Maury --- In flexcoders@yahoogroups.com, flexjeremy flexjeremy@ wrote: Hello helpful list, I seem to be confusing myself. I'm using ColdFusion to get the data out of our database. Simple. I got a remote object getting the data. mx:RemoteObject id=remoteService destination=ColdFusion source=Cows3.cows showBusyCursor=true/ Now what I want to do is firstly get the data into it. I tried this by doing the following. mx:ComboBox id=ProcessorName dataProvider={remoteService.getProcessors.lastResult} /mx:ComboBox Now I know that it needs to be in an Array. When I dump the data into a grid. It works fine. i.e. mx:DataGrid dataProvider={remoteService.getProcessors.lastResult} /mx:DataGrid All the examples on Adobe's site is shitting me. Cause they are put in from an Array they manually make. Help. Again. Jeremy
Re: [flexcoders] Re: mx:ComboBox
Hi Maury, Um. Thanks for that. Without sounding like a complete idiot...where would you put that. I know enough to be dangerous. But not enough to be useful at this point. Jeremy - Original Message From: Maury Sword [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Tuesday, 27 March, 2007 7:20:41 AM Subject: [flexcoders] Re: mx:ComboBox Try this: for (var i:Number=0; i bob.dataProvider. length; i++) { if (bob.dataProvider[ i].bobid == mybobid) { bob.selectedIndex = i; break; } } --- In [EMAIL PROTECTED] ups.com, flexjeremy flexjeremy@ ... wrote: Boy do I feel like a dork. Excellent. Thank you. One last thing if I were getting a value out of the database is there a way to say that item is selected? I know how to do this in ColdFusion, but I'm thinking that would be totally different in Flex. SO for example in CF we do it this way. select name=bob id=bob option value=#mybobid# cfif mybobid IS mybobidfromdb selected /cfif#mybob# /option /select In flex we do it..? *insert blank look from jeremy* Jeremy --- In [EMAIL PROTECTED] ups.com, Maury Sword maury.sword@ wrote: Jeremy, You will need to specify a labelField or labelFunction in order for the ComboBox to know what you want to display. Maury --- In [EMAIL PROTECTED] ups.com, flexjeremy flexjeremy@ wrote: Hello helpful list, I seem to be confusing myself. I'm using ColdFusion to get the data out of our database. Simple. I got a remote object getting the data. mx:RemoteObject id=remoteService destination= ColdFusion source=Cows3. cows showBusyCursor= true/ Now what I want to do is firstly get the data into it. I tried this by doing the following. mx:ComboBox id=ProcessorName dataProvider= {remoteService. getProcessors. lastResult} /mx:ComboBox Now I know that it needs to be in an Array. When I dump the data into a grid. It works fine. i.e. mx:DataGrid dataProvider= {remoteService. getProcessors. lastResult} /mx:DataGrid All the examples on Adobe's site is shitting me. Cause they are put in from an Array they manually make. Help. Again. Jeremy !-- #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;} -- Send instant messages to your online friends http://au.messenger.yahoo.com
[flexcoders] Re: mx:ComboBox
Jeremy, I would normally do this in the RemoteObject result handler for the data that contains the id that is the selection. For instance let's say you have a ComboBox populated with a list of US States. You retrieve an Employee record from a datasource via Remoting, when that data is returned it would contain the state_id that you want selected out of the comboBox. Then you could call the code to select the correct state out of the ComboBox. Maury --- In flexcoders@yahoogroups.com, Jeremy Watson [EMAIL PROTECTED] wrote: Hi Maury, Um. Thanks for that. Without sounding like a complete idiot...where would you put that. I know enough to be dangerous. But not enough to be useful at this point. Jeremy - Original Message From: Maury Sword [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Tuesday, 27 March, 2007 7:20:41 AM Subject: [flexcoders] Re: mx:ComboBox Try this: for (var i:Number=0; i bob.dataProvider. length; i++) { if (bob.dataProvider[ i].bobid == mybobid) { bob.selectedIndex = i; break; } } --- In [EMAIL PROTECTED] ups.com, flexjeremy flexjeremy@ ... wrote: Boy do I feel like a dork. Excellent. Thank you. One last thing if I were getting a value out of the database is there a way to say that item is selected? I know how to do this in ColdFusion, but I'm thinking that would be totally different in Flex. SO for example in CF we do it this way. select name=bob id=bob option value=#mybobid# cfif mybobid IS mybobidfromdb selected /cfif#mybob# /option /select In flex we do it..? *insert blank look from jeremy* Jeremy --- In [EMAIL PROTECTED] ups.com, Maury Sword maury.sword@ wrote: Jeremy, You will need to specify a labelField or labelFunction in order for the ComboBox to know what you want to display. Maury --- In [EMAIL PROTECTED] ups.com, flexjeremy flexjeremy@ wrote: Hello helpful list, I seem to be confusing myself. I'm using ColdFusion to get the data out of our database. Simple. I got a remote object getting the data. mx:RemoteObject id=remoteService destination= ColdFusion source=Cows3. cows showBusyCursor= true/ Now what I want to do is firstly get the data into it. I tried this by doing the following. mx:ComboBox id=ProcessorName dataProvider= {remoteService. getProcessors. lastResult} /mx:ComboBox Now I know that it needs to be in an Array. When I dump the data into a grid. It works fine. i.e. mx:DataGrid dataProvider= {remoteService. getProcessors. lastResult} /mx:DataGrid All the examples on Adobe's site is shitting me. Cause they are put in from an Array they manually make. Help. Again. Jeremy !-- #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
Re: [flexcoders] Re: mx:ComboBox
Oh okay, I think I understand. So I would call the code when its coming back from RemoteObject. Thanks again. I'll give that a go. Jeremy - Original Message From: Maury Sword [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Tuesday, 27 March, 2007 9:28:29 AM Subject: [flexcoders] Re: mx:ComboBox Jeremy, I would normally do this in the RemoteObject result handler for the data that contains the id that is the selection. For instance let's say you have a ComboBox populated with a list of US States. You retrieve an Employee record from a datasource via Remoting, when that data is returned it would contain the state_id that you want selected out of the comboBox. Then you could call the code to select the correct state out of the ComboBox. Maury --- In [EMAIL PROTECTED] ups.com, Jeremy Watson flexjeremy@ ... wrote: Hi Maury, Um. Thanks for that. Without sounding like a complete idiot...where would you put that. I know enough to be dangerous. But not enough to be useful at this point. Jeremy - Original Message From: Maury Sword maury.sword@ ... To: [EMAIL PROTECTED] ups.com Sent: Tuesday, 27 March, 2007 7:20:41 AM Subject: [flexcoders] Re: mx:ComboBox Try this: for (var i:Number=0; i bob.dataProvider. length; i++) { if (bob.dataProvider[ i].bobid == mybobid) { bob.selectedIndex = i; break; } } --- In [EMAIL PROTECTED] ups.com, flexjeremy flexjeremy@ ... wrote: Boy do I feel like a dork. Excellent. Thank you. One last thing if I were getting a value out of the database is there a way to say that item is selected? I know how to do this in ColdFusion, but I'm thinking that would be totally different in Flex. SO for example in CF we do it this way. select name=bob id=bob option value=#mybobid# cfif mybobid IS mybobidfromdb selected /cfif#mybob# /option /select In flex we do it..? *insert blank look from jeremy* Jeremy --- In [EMAIL PROTECTED] ups.com, Maury Sword maury.sword@ wrote: Jeremy, You will need to specify a labelField or labelFunction in order for the ComboBox to know what you want to display. Maury --- In [EMAIL PROTECTED] ups.com, flexjeremy flexjeremy@ wrote: Hello helpful list, I seem to be confusing myself. I'm using ColdFusion to get the data out of our database. Simple. I got a remote object getting the data. mx:RemoteObject id=remoteService destination= ColdFusion source=Cows3. cows showBusyCursor= true/ Now what I want to do is firstly get the data into it. I tried this by doing the following. mx:ComboBox id=ProcessorName dataProvider= {remoteService. getProcessors. lastResult} /mx:ComboBox Now I know that it needs to be in an Array. When I dump the data into a grid. It works fine. i.e. mx:DataGrid dataProvider= {remoteService. getProcessors. lastResult} /mx:DataGrid All the examples on Adobe's site is shitting me. Cause they are put in from an Array they manually make. Help. Again. Jeremy !-- #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
RE: [flexcoders] Re: mx:ComboBox selectedItem ={blah} (flex 2)
If the contents of the list is a string setting selectedItem should just work. If its an object and you have a ref to the same object in the CB, setting selectedItem should work. If you just have matching values youll probably need to loop, unless the objects in the dataProvider implement IUID and then you could try to pass an object that has the same uid value as the one you want to select. That of course is harder to pull off. Matt From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of John C. Bland II Sent: Friday, April 28, 2006 11:59 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: mx:ComboBox selectedItem ={blah} (flex 2) I've already tried that. Well, not getItemAt because I used items.selectedItem (same thing). On 4/28/06, Suzy Lawson [EMAIL PROTECTED] wrote: selectedItem={items.getItemAt(3).fieldName} --- In flexcoders@yahoogroups.com, John C. Bland II [EMAIL PROTECTED] wrote: I am working with some a combo and the custom component listing the states works perfectly fine for simply saying: selectedItem={ items.selectedItem.state}. It will change and work as expected (when the grid is clicked). Well, that component is nothing but a mx:dataProvider with mx:String values inside. So the selectedItem is a string (when calling mycombo.selectedItem) as opposed to an object. My question is, when you have an object as the dp to a combo (or any other component with selectedItem) how do you set the selected item without doing a loop + if to find the proper selectedIndex? Thanks, -- John C. Bland II I do what I can do when I can do it. - Chris Tucker, Money Talks http://www.gotoandstop.org - Home of FMUG.az -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service . -- John C. Bland II I do what I can do when I can do it. - Chris Tucker, Money Talks http://www.gotoandstop.org - Home of FMUG.az -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[flexcoders] Re: mx:ComboBox selectedItem ={blah} (flex 2)
selectedItem={items.getItemAt(3).fieldName} --- In flexcoders@yahoogroups.com, John C. Bland II [EMAIL PROTECTED] wrote: I am working with some a combo and the custom component listing the states works perfectly fine for simply saying: selectedItem={ items.selectedItem.state}. It will change and work as expected (when the grid is clicked). Well, that component is nothing but a mx:dataProvider with mx:String values inside. So the selectedItem is a string (when calling mycombo.selectedItem) as opposed to an object. My question is, when you have an object as the dp to a combo (or any other component with selectedItem) how do you set the selected item without doing a loop + if to find the proper selectedIndex? Thanks, -- John C. Bland II I do what I can do when I can do it. - Chris Tucker, Money Talks http://www.gotoandstop.org - Home of FMUG.az -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. 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] Re: mx:ComboBox selectedItem ={blah} (flex 2)
I've already tried that. Well, not getItemAt because I used items.selectedItem (same thing).On 4/28/06, Suzy Lawson [EMAIL PROTECTED] wrote: selectedItem={items.getItemAt(3).fieldName} --- In flexcoders@yahoogroups.com, John C. Bland II [EMAIL PROTECTED] wrote: I am working with some a combo and the custom component listing the states works perfectly fine for simply saying: selectedItem={ items.selectedItem.state}. It will change and work as expected (when the grid is clicked). Well, that component is nothing but a mx:dataProvider with mx:String values inside. So the selectedItem is a string (when calling mycombo.selectedItem) as opposed to an object. My question is, when you have an object as the dp to a combo (or any other component with selectedItem) how do you set the selected item without doing a loop + if to find the proper selectedIndex? Thanks, -- John C. Bland II I do what I can do when I can do it. - Chris Tucker, Money Talks http://www.gotoandstop.org - Home of FMUG.az -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service . -- John C. Bland III do what I can do when I can do it. - Chris Tucker, Money Talkshttp://www.gotoandstop.org - Home of FMUG.az -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.