I have created a custom editor for my dataGrid.  I am also handling
the itemEditEnd event.  When focus exists in a cell in this column and
I try to TAB out, I am prevented... In tracing through the code, (in
DataGrid.as, I believe I know why.. but not sure if this is a bug or
by design).  Of course, I want to claim it is a bug... so my issue can
get solved, but perhaps there are other reasons..

During the processData method below, we call event.preventDefault().
In DataGrid.as (source code from beta 3), in the
"findNextItemRenderer" method, there is a check as to
<code>
   if (!itemEditorInstance || endEdit(reason))
</code>

and because the itemEditor exists AND the endEdit method returns
false, the code does not fall into the block to BEGIN editing the next
cell.


Take for example the following:  (simplified the version taken from
the docs "Example: Passing multiple values back from an item editor")

Application file:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  width="700">
   
    <mx:Script>
        <![CDATA[

            import mx.events.DataGridEvent;
                       
            [Bindable]
            public var initDG:Array = [
                {Company: 'Acme', Contact: 'Bob Jones', Phone:
'413-555-1212',
                    City: 'Boston', State: 'MA'},
                {Company: 'Allied', Contact: 'Jane Smith', Phone:
'617-555-3434',
                    City: 'SanFrancisco', State: 'CA'} ];
               
            // Define the event listener.
            public function processData(event:DataGridEvent):void {

                // Check the reason for the event.
                if (event.reason == DataGridEventReason.OTHER ||
                        event.reason == DataGridEventReason.CANCELLED){
                    // Do not update cell.
                    return;
                }           

                if(event.dataField == "State"){
                               
                    // Disable copying data back to the control.
                    event.preventDefault();

                    // Get new state from editor.
                    myGrid.editedItemRenderer.data.State=
StateEditor(event.currentTarget.itemEditorInstance).selectedItem;

                    // Close the item editor.
                    myGrid.destroyItemEditor();   
                   
                    // Notify the list control to update its display.
              
myGrid.dataProvider.notifyItemUpdate(myGrid.editedItemRenderer);
                }
            }           
                   
        ]]>
    </mx:Script>
   
    <mx:DataGrid id="myGrid" dataProvider="{initDG}" editable="true"
itemEditEnd="processData(event);">   
        <mx:columns>
            <mx:DataGridColumn dataField="Company"/>
            <mx:DataGridColumn dataField="City"/>
            <mx:DataGridColumn dataField="State" width="150"
                    itemEditor="StateEditor">
                <mx:itemRenderer>
                    <mx:Component>
                        <mx:Text selectable="false" width="100%"
                            text="{data.State}"/>
                    </mx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
            <mx:DataGridColumn dataField="Contact"/>
            <mx:DataGridColumn dataField="Phone"/>
        </mx:columns>       
    </mx:DataGrid>        
</mx:Application>


StateEditor.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
selectedItem="{data.State}">
    <mx:dataProvider>
        <mx:String>AL</mx:String>
        <mx:String>AK</mx:String>
        <mx:String>AR</mx:String>
        <mx:String>CA</mx:String>
        <mx:String>MA</mx:String>
    </mx:dataProvider>
</mx:ComboBox>



So.... long story short, how do I allow easy tabbing through this
situation...






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




Reply via email to