If you wrap CB in a VBox, your renderer is going to be very heavy and
slow as VBox measures it and tries to layout a stack of things but the
stack has only one thing in it.  Also, the VBox is not an
iFocusManagerComponent so it won't be assigned focus.  You'd be better
off just subclassing CB, but you can wire up the VBox to be an
IFocusManagerComponent if you really need to

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Chilcoat, Dee
Sent: Friday, August 22, 2008 12:13 PM
To: '[email protected]'
Subject: [flexcoders] Tabbing into Combobox in Datagrid

 

I have a combobox in a cell in a datagrid.  Surrounding the cell with
the combobox in it, are cells with text fields.  I can tab from cell to
cell, but when I try to tab to the combobox, the cursor skips over it.
I want to be able to tab into the combobox.  Code for the datagrid is
below.  The OtherCodeRenderer creates the combobox. I tried setting
editable to true for that cell; the combobox gets changed to a text
field when I tab into it.    I have included the code for the
OtherCodeRenderer below, also.  Any help will be appreciated.  Thank
you.

 

                <mx:DataGrid

 
dataProvider="{quickObject.dataProvider}"

                                sortableColumns="false" 

                                resizableColumns="false" 

                                id="quickEntryGrid"

                                editable="true"

                                dragEnabled="false"

                                rowCount="15"

                                rowRenderer="ErrorRowRenderer"

                                

                                cellEdit="doCellEdit(event)"

                                cellFocusIn="doCellFocusIn(event)"

                                cellFocusOut="doCellFocusOut(event)">

                                <mx:columns>

                                                <mx:Array>

 
<mx:DataGridColumn headerText="VAC" width="53"
columnName="timerecordTrcVacationHours" 

 
<mx:DataGridColumn headerText="OTHER" width="53"
columnName="timerecordTrcOtherHours" editable="true" />

 
<mx:DataGridColumn headerText="O" width="21"
columnName="timerecordOtherHoursCodeLetter" />

 
<mx:DataGridColumn headerText="CODE" width="130"
columnName="timerecordTrcOtherHoursCode"
cellRenderer="{OtherCodeRenderer}" editable="false"/>

                                                </mx:Array>

                                </mx:columns>

                </mx:DataGrid>

                                                

OtherCodeRenderer

<?xml version="1.0" encoding="utf-8"?> 

<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml"; marginLeft="0"
marginBottom="0" marginRight="0" marginTop="0" height="100%"
width="100%" backgroundAlpha="0" verticalAlign="middle"
horizontalAlign="center" > 

 

                <mx:Script>

<![CDATA[

                var listOwner : Object; // the reference we receive to
the list

                var getCellIndex : Function; // the function we receive
from the list

                var getDataLabel : Function; // the function we receive
from the list

 

                function setValue( str : String, item : Object,
selection : String ) : Void {

                                for( var i = 0; i <
combo.dataProvider.length; i++ ) {

                                                if(
combo.dataProvider[i].data == item[ getDataLabel() ] ) {

 
combo.selectedIndex = i;

                                                                break;

                                                }else{

 
combo.selectedIndex = 0;

                                                }

                                }

                }

                

                function change() {

 
if(listOwner.dataProvider[getCellIndex().itemIndex].timerecordTrcUpdateU
serId != null &&

 
listOwner.dataProvider[getCellIndex().itemIndex].timerecordTrcUpdateUser
Id != "" && 

                                parentDocument.parentDocument.userId !=
listOwner.dataProvider[getCellIndex().itemIndex].timerecordTrcUpdateUser
Id) {

 
parentDocument.detailStatus = "You cannot modify a row that you have not
modified previously.";                

 
parentDocument.changesMade = true;

 
parentDocument.allButtonsFalse();

                                                return;

                                }              

                                

                }

]]>

                </mx:Script>

<mx:ComboBox height="40" width="100%" id="combo"  

                change="change(event)"
dataProvider="{parentDocument.otherHoursCodeDataProvider}" /> 

</mx:VBox>

 

 

Dee A. Chilcoat

Enterprise Web Application Development

University of California San Diego

[EMAIL PROTECTED]

(858) 534-0719

 

Reply via email to