When set editable=true for a ComboBox renderer, I will listen CB 'close' 
event and force an itemEditEnd by moving focus to a ModelLocator 
component(.setFocus()) in next frame(callLater function required). It 
can be used in  some cases without trouble.

George

Tracy Spratt wrote:
> 
> 
> I’ve experimented some with this and found that editable=”true” on a 
> ComboBox renderer can cause some very unexpected behavior.  I have had 
> most success by ensuring that my renderers handle the dataprovider item 
> updates themselves.  ComboBox and item renderers are complex enough 
> without adding the default DataGrid editing functionality into the mix.
> 
> You can leave editable=”true” on the DG, but set it to false on any 
> DataGridColumn with a complex renderer.
> 
> Now, thinking about it some more, the issue might be solved by ensuring 
> your renderer does NOT update the item itself.  Might try that.
> 
> Tracy 
> 
> ------------------------------------------------------------------------
> 
> *From:* [email protected] [mailto:[EMAIL PROTECTED] 
> *On Behalf Of *Alex Harui
> *Sent:* Saturday, November 24, 2007 3:22 AM
> *To:* [email protected]
> *Subject:* RE: [flexcoders] ComboBox and DataGrid - set data() call 
> causes next ComboBox to collapse...
> 
>  
> 
> Did you set editable=true on the DG?  If so, it should update the data 
> on itemEditEnd and not on change.
> 
> ------------------------------------------------------------------------
> 
> *From:* [email protected] [mailto:[EMAIL PROTECTED] 
> *On Behalf Of *cmarkiewicz
> *Sent:* Friday, November 23, 2007 1:43 PM
> *To:* [email protected]
> *Subject:* [flexcoders] ComboBox and DataGrid - set data() call causes 
> next ComboBox to collapse...
> 
> 
> Hello. I have a DataGrid with a column of ComboBoxes. The behavior I'm
> seeing is this:
> 1) I click on a ComboBox - it expands
> 2) I choose a value - it collapses
> 3) I click on a ComboBox in a different column
> 4) It expands - then immediately collapses
> 
> I have determined why it is happening, but I'm not sure how to make it stop.
> 
> I have a separate mxml file where I define the ComboBox and I override the
> set data() method. The set data() method sets the value in the ComboBox in
> each row. The issues is that after I change a ComboBox in one row, set
> data() is called on all rows - so as soon as I click on the second ComboBox,
> set data() is called (because I clicked away from the first ComboBox), the
> value is set in the second ComboBox - and it collapses.
> 
> So, if I change the value in one ComboBox, click to some other cell, then
> click on the second ComboBox, it works fine (because set data() is called
> when i click to the other cell). So my questions is, how do I make this
> work? Can I force the call to set data() as soon as the first ComboBox
> collapses (my putting focus on another component temporarily?)? Or can I
> make it bypass the set data() call from ComboBoxes which weren't touched?
> 
> Any help is greatly appreciated.
> 
> Code is below, if it helps...
> 
> Thanks
> Chris
> 
> <?xml version="1.0" encoding="utf-8"?>
> <!-- mxmlcomponents/TypeComboBoxRenderer.mxml -->
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml 
> <http://www.adobe.com/2006/mxml>"
> xmlns:lib="t3quote.*"
> horizontalScrollPolicy="off" verticalScrollPolicy="off"
>>
> <mx:Script>
> <![CDATA[
> import mx.messaging.channels.StreamingAMFChannel;
> // Define a property for returning the new value to the cell.
> [Bindable]
> public var valueSelected:String;
> 
> 
> override public function set data(value:Object):void
> {
> if(value != null)
> {
> super.data = value;
> trace("set data...data.productCode:"+data.productCode);
> 
> //show the comboBox
> if(value.nonPartFlag)
> {
> prodCodeChoices.visible=true;
> prodCodeLabel.visible=false;
> }
> //hide the comboBox and show the label
> else
> {
> prodCodeChoices.visible=false;
> prodCodeLabel.visible=true;
> }
> 
> var pcArr:Array = data.productCodeArray;
> for (var j:int = 0; j < pcArr.length; j++)
> {
> var pctmp:String = pcArr[j];
> if (pctmp == data.productCode)
> {
> 
> trace("PrevIndex/NewIndex:"+prodCodeChoices.selectedIndex+"/"+j);
> 
> trace("PrevItem/NewItem:"+prodCodeChoices.selectedItem+"/"+data.productCode);
> trace("Match found!!!:"+j+"/"+pctmp);
> prodCodeChoices.selectedIndex = j;
> }
> }
> 
> 
> }
> }
> 
> 
> public function changeHandler(event:Event): void
> {
> 
> trace("changeHandler...prodCodeChoices.selectedItem:"+prodCodeChoices.selectedItem);
> valueSelected = String(prodCodeChoices.selectedItem);
> }
> ]]>
> </mx:Script>
> 
> <mx:ComboBox id="prodCodeChoices" dataProvider="{data.productCodeArray}"
> width="100%"
> change="changeHandler(event)"
> creationComplete="prodCodeChoices.selectedItem=data.productCode"
> />
> <!--
> <lib:ComboBox id="prodCodeChoices" dataProvider="{data.productCodeArray}"
> width="100%"
> value="{data.productCode}"
> />
> -->
> <mx:Label id="prodCodeLabel" text="{data.productCode}" />
> 
> </mx:Canvas>
> 
>


--
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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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