Thanks Doug, but for some reason that's not working for me.

--- In [email protected], "Doug Lowder" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> In function updateStateCbx(), try calling the following: 
> dgLocationInfo.dataProvider.editField(selIdx, "data", selState).  
> The grid should notice the change to the dataprovider and cause your 
> cell renderer to automatically update the combobox.
> 
> Regards,
> Doug
> 
> 
> --- In [email protected], "mrvinedit" <owner@> wrote:
> >
> > I'm passing in selIdx and selState variables from another mxml not
> > shown here, but suffice to say my alert is showing the correct data
> > for the index of the state and the state's data. For some reason 
> (must
> > be my code :-) the datagrid-embedded combobox is not changing the
> > state that's coming in from my data. Suggestions?
> > 
> > Grid.mxml:
> > 
> > <mx:Script>
> > <![CDATA[
> >   function updateStateCbx(selIdx,selState): {
> >     mx.controls.Alert.show(selIdx + ': ' + selState);
> >     dgLocationInfo.selectedItem.LocState.editField(selIdx, "data",
> > selState);
> >   }
> > ]]>
> > </mx:Script>
> >     
> > <mx:DataGrid id="dgLocationInfo" width="90%" editable="true"
> > dataProvider="{aryLoc}" rowCount="5"
> > change="updateGridRowModel
> (dgLocationInfo.selectedItem.LocNum,dgLocationInfo.selectedItem.LocAd
> dr,dgLocationInfo.selectedItem.LocZip,dgLocationInfo.selectedItem.Loc
> City,dgLocationInfo.selectedItem.LocState)">
> >   <mx:columns>
> >     <mx:Array>
> >       <mx:DataGridColumn headerText="State" columnName="LocState"
> > editable="false" cellRenderer="StateRenderer" width="120"/>
> >     </mx:Array>
> > </mx:DataGrid>
> > 
> > StateRenderer:
> > 
> > import mx.controls.ComboBox;
> > 
> > class StateRenderer extends mx.core.UIComponent {
> > 
> >     var comboDP:Array = [{label:"Alabama", data:"AL"}, 
> {label:"Alaska",
> > data:"AK"}, {label:"Arizona", data:"AZ"}, {label:"Arkansas",
> > data:"AR"}, {label:"California", data:"CA"}, {label:"Colorado",
> > data:"CO"}, {label:"Connecticut", data:"CT"}, {label:"Delaware",
> > data:"DE"}, {label:"Florida", data:"FL"}, {label:"Georgia",
> > data:"GA"}, {label:"Hawaii", data:"HI"}, {label:"Idaho", 
> data:"ID"},
> > {label:"Illinois", data:"IL"}, {label:"Indiana", data:"IN"},
> > {label:"Iowa", data:"IA"}, {label:"Kansas", data:"KS"},
> > {label:"Kentucky", data:"KY"}, {label:"Louisiana", data:"LA"},
> > {label:"Maine", data:"ME"}, {label:"Maryland", data:"MD"},
> > {label:"Massachusetts", data:"MA"}, {label:"Michigan", data:"MI"},
> > {label:"Minnesota", data:"MN"}, {label:"Mississippi", data:"MS"},
> > {label:"Missouri", data:"MO"}, {label:"Montana", data:"MT"},
> > {label:"Nebraska", data:"NE"}, {label:"Nevada", data:"NV"},
> > {label:"New Hampshire", data:"NH"}, {label:"New Jersey", 
> data:"NJ"},
> > {label:"New Mexico", data:"NM"}, {label:"New York", data:"NY"},
> > {label:"North Carolina", data:"NC"}, {label:"North Dakota",
> > data:"ND"}, {label:"Ohio", data:"OH"}, {label:"Oklahoma", 
> data:"OK"},
> > {label:"Oregon", data:"OR"}, {label:"Pennsylvania", data:"PA"},
> > {label:"Rhode Island", data:"RI"}, {label:"South Carolina",
> > data:"SC"}, {label:"South Dakota", data:"SD"}, {label:"Tennessee",
> > data:"TN"}, {label:"Texas", data:"TX"}, {label:"Utah", data:"UT"},
> > {label:"Vermont", data:"VT"}, {label:"Virginia", data:"VA"},
> > {label:"Washington", data:"WA"} ];
> >     var combo;
> >     var listOwner : MovieClip;
> >     var getCellIndex : Function;
> >     var getDataLabel : Function;
> >     
> >     function createChildren(Void) : Void {
> >             combo = createClassObject( ComboBox, "combo", 1, 
> {owner:this, _x:1});
> >             combo.dataProvider = comboDP;
> >             combo.addEventListener("change", this);
> >     }
> >     
> >     function getPreferredHeight(Void) : Number{
> >             return combo != undefined ? 18:0;
> >     }
> >     
> >     function getPreferredWidth(Void) : Number{
> >             return combo != undefined ? 100:0;
> >     }
> > 
> >     function setValue(str:String, item:Object) {
> >             var val = item.state;
> >             for(var i = 0; i < combo.dataProvider.length; i++) {
> >                     combo.dataProvider[i].data == val ? 
> combo.selectedIndex = i : '';
> >             }
> >     }
> >     
> >     function change() {
> >             listOwner.editField(getCellIndex().itemIndex, 
> getDataLabel(),
> > combo.selectedItem.data);
> >             listOwner.selectedIndex = getCellIndex().itemIndex;
> >     }
> > }
> >
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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:
    http://docs.yahoo.com/info/terms/
 


Reply via email to