Actually itemEditEnd in the real sceanrio looks like below.
Since i am uisng the nested datafield i am calling the
event.preventDefault();
datGrid.destroyItemEditor();
datGrid.dataProvider.itemUpdated(event.itemRenderer.data);
So my dataprovider gets updated with the new value when i use the mouse but
with the key board focus does not move from column1 to column2
Any pointers....
private function onitemEditEnd(event:DataGridEvent):void
{
var datGrid:CheckBoxDataGrid=(event.currentTarget as CheckBoxDataGrid);
if (event.reason == DataGridEventReason.CANCELLED)
return;
var selectedObject:Object=datGrid.dataProvider[event.rowIndex];
var
customDataGridColumn:CustomDataGridColumn=datGrid.columns[event.columnIndex] as
CustomDataGridColumn;
var field:String=datGrid.columns[event.columnIndex].dataField;
var array:Array=field.split(".");
if (customDataGridColumn.isPopupEditor)
{
event.preventDefault();
datGrid.destroyItemEditor();
return;
}
if (array != null && array.length >= 2)
{
event.preventDefault();
var object:Object=selectedObject[array[0]];
var textEnteredByUser:String;
if (datGrid.itemEditorInstance is IEditorValue)
{
textEnteredByUser=IEditorValue(datGrid.itemEditorInstance).editValue;
object[array[1]]=textEnteredByUser;
}
else
{
textEnteredByUser=TextInput(datGrid.itemEditorInstance).text;
object[array[1]]=textEnteredByUser;
}
datGrid.destroyItemEditor();
datGrid.dataProvider.itemUpdated(event.itemRenderer.data);
}
}
--- In [email protected], "Rajan" <ilikef...@...> wrote:
>
> Hi
>
> I have created simple test case to identify the issue.
>
> If i remove itemEditEnd then i have no issues with the focus. It works
> cleanly and focus moves from one column to another.
>
> But if add itemEditEnd then focus does not move from 1st column to 2 nd
> column.
>
> So event.preventDefault(); statement is the culprit.
> but i cannot remove this because in the real scenario i am using nested
> datafield.
>
> So how to make the focus move from colimn1 to column2.
>
> any pointers are higly appreciated.
>
> <?xml version="1.0"?>
> <!-- itemRenderers\inline\CBInlineCellEditor.mxml -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
>
> <mx:Script>
> <![CDATA[
> import mx.events.DataGridEvent;
> import mx.collections.ArrayCollection;
>
> [Bindable]
> public var ac:ArrayCollection = new ArrayCollection(
> [{dateString:"11/12/2006", contact:"ABD DEF", dt: new
> Date(2003,10,23)},
> {dateString:"11/12/2007", contact:"GHI", dt:new Date(2004,11,2)},
> {dateString:"10/10/2007", contact:"JKL MNOP", dt:new
> Date(2007,4,14)},
> {dateString:"09/12/2007", contact:"QRSTUV W XY Z", dt:new
> Date(2006,1,1)}]);
>
> private function onitemEditEnd(event:DataGridEvent):void
> {
> event.preventDefault();
> }
> ]]>
> </mx:Script>
>
> <mx:DataGrid id="myDG"
> dataProvider="{ac}"
> variableRowHeight="true"
> width="500" height="250"
> itemEditEnd="onitemEditEnd(event)"
> editable="true">
> <mx:columns>
> <mx:DataGridColumn headerText="DateString" dataField="dateString"
> width="120"
> itemEditor="com.DateEditor"
> editorDataField="text" />
> <mx:DataGridColumn headerText="Date" dataField="dt"
> width="120"
> itemRenderer="mx.controls.DateField"
> rendererIsEditor="true"
> editorDataField="selectedDate"/>
> <mx:DataGridColumn headerText="Contact" dataField="contact"
> width="80"/>
> </mx:columns >
> </mx:DataGrid>
> </mx:Application>
>
>
>
> Source Code for com.DateEditor is at
> http://blogcode.flexmonkeypatches.com/__FMP_datagrid_datefield_editor_asString/srcview/index.html
>
>
>
>
>
>
>
> --- In [email protected], "Rajan" <ilikeflex@> wrote:
> >
> > I have put the following code in the datagrid and found that couple of
> > times 'itemEditorInstance' is null.So the focus does not move ahead.
> >
> > Any pointer..
> >
> > override protected function keyDownHandler(event:KeyboardEvent):void
> > {
> > // this is technically illegal, but works
> > //event.ctrlKey = true;
> > //event.shiftKey = false;
> > trace( 'Datagerid keyDownHandler itemEditorInstance ' +
> > itemEditorInstance);
> > trace( 'Datagerid keyDownHandler event.target ' + event.target
> > + '\n event.currentTarget ' + event.currentTarget + ( event.target !=
> > event.currentTarget ));
> > //trace("Datagerid keyDownHandler " + event.keyCode + " " +
> > event.shiftKey + " " + event.ctrlKey);
> > super.keyDownHandler(event);
> > trace("Datagerid keyDownHandler gefocus" + getFocus());
> > trace( 'Datagerid keyDownHandler itemEditorInstance
> > -------------------------------------------------------');
> > }
> >
> > --- In [email protected], Alex Harui <aharui@> wrote:
> > >
> > > Add a focusIn handler on the app that displays the event.target and
> > > event.relatedObject. Maybe that will generate some clues.
> > >
> > >
> > > On 7/20/10 10:25 AM, "Rajan" <ilikeflex@> wrote:
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Actually, i have same itemeditor in different columns.
> > >
> > > Column1
> > > 1.One Tab - focus on textinput
> > > 2.Second Tab - focus on image.
> > >
> > > 3.Third Tab - Don't know where does the focus goes.
> > >
> > > Column2
> > > 4.Fourth Tab - focus on textinput
> > > 5.Fifth Tab - focus on image.
> > >
> > > I want to fix that on third tab it show go to textinput of another
> > > column. As it works for you on your sample
> > >
> > > So how to fix this.
> > >
> > > Thanks
> > > ilikeflex
> > >
> > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> ,
> > > Alex Harui <aharui@> wrote:
> > > >
> > > > Your item editor has two focusable components? Then you should have to
> > > > tab twice in each column. Are you having to tab more than that?
> > > >
> > > >
> > > > On 7/20/10 7:03 AM, "Rajan" <ilikeflex@> wrote:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Hi
> > > >
> > > > http://blogs.adobe.com/aharui/category/item-renderers
> > > >
> > > > http://blogs.adobe.com/aharui/DataGridMultiFieldEditor/DataGridMultiFieldEditorTest.swf
> > > >
> > > > I looked to this example and i am using the custom item editor. My
> > > > itemeditor has two components( text input + image ). Everything works
> > > > fine and i am able to navigate through the componnets in the item
> > > > editor using key board also. I have exactly same piece of the code as
> > > > in url.
> > > >
> > > > The problem i am facing is that i have to press Tab Key multiple times
> > > > to move form one datagrid column to another if both the column has same
> > > > custom itemeditor.
> > > >
> > > > Any pointers???
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Alex Harui
> > > > Flex SDK Team
> > > > Adobe System, Inc.
> > > > http://blogs.adobe.com/aharui
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Alex Harui
> > > Flex SDK Team
> > > Adobe System, Inc.
> > > http://blogs.adobe.com/aharui
> > >
> >
>