|
Huh? I can always be wrong, but I did not
think that editable fields automatically updated a dataProvider. I will go
test this now. Tracy From:
Thank you very much the info. I have a question for you about the NOTE you
mentioned in earlier mail. Are you referring editcell event and editField( )
method with reference to new row or in general any cell? To my surprise I did
not trap editcell event and did not call editField( ) on cells but I am able to
save data changes to the data base, but not the data entered for the new row
though. This makes me think that I have to call editField( ) on newly added
row, am I correct? Thanks! -----Original Message----- Calling addItem() on the
dataGrid is actually calling it on the dataProvider and physically adding the
line. Now, that line is empty,
the "item" would be undefined (null?), and NOTE THIS: editing a
datagrid cell does not automatically update the datagrid. You will need
to use the editCell event to call editField() to update the dp with the entered
data. I bet your dataProvider has a line but it is empty. From: Hi,
I would like to extend the scope of this thread by asking How to make this
newly added row as a part of the dataprovider? What I mean is I am able to
create a new row in datagrid by using your methodology. But when I try to
access data in my POJO, I am getting nullpointer exception. That means, I
think, the newly added row to grid is not truly added to dataprovider. Do I
have to make any specific function call to make the newly added row attach to
dataprovider? If this question is already discussed, please guide me with
reference. Thanks! -----Original Message----- Here's a little mod that automatically adds the new
row when you tab out of the last cell. The doLater reminder solved an
aggravating problem I was having! <?xml version="1.0"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*"> <mx:Script><![CDATA[ function checkOnNav(oEvent:Object):Void { var iItemIndex:Number; var
iColumnIndex:Number; switch (oEvent.type) { case
"cellFocusOut":
iItemIndex = oEvent.itemIndex;
iColumnIndex = oEvent.columnIndex
if (iColumnIndex == oEvent.target.columnNames.length - 1
&& iItemIndex == oEvent.target.length -
1 )
{
//leaving the last row, last column
oEvent.target.addItem();
doLater(this,"focusLastRow",[oEvent])
}
break; }//switch (oEvent.type) }//checkOnNav private function
focusLastRow(oEvent:Object):Void{ var dg:mx.controls.DataGrid = oEvent.target;
dg.setFocus();
dg.focusedCell = {columnIndex: 0, itemIndex: dg.dataProvider.length-1}; }//setFocusNextLine ]]></mx:Script> <mx:DataGrid id="grid" editable="true"
cellFocusOut="checkOnNav(event)"> <mx:dataProvider>
<mx:Array>
<mx:Object name="manish" colour="red" />
<mx:Object name="abdul" colour="blue" />
</mx:Array>
</mx:dataProvider> </mx:DataGrid> </mx:Application> -----Original Message----- On 5/19/05, shettyaditsathish
<[EMAIL PROTECTED]> wrote: > i need to create a row in an existing datagrid on
an event and show the > the 1st column of the newly created row in
editable mode. <?xml version="1.0"?> <mx:Application
xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*"> <mx:Script> function enterNewRow():Void { grid.addItem(); focusNewRow(); doLater(this,
"focusNewRow"); } function focusNewRow():Void { grid.setFocus(); grid.focusedCell =
{columnIndex: 0, itemIndex: grid.dataProvider.length-1}; } </mx:Script> <mx:DataGrid id="grid"
editable="true"> <mx:dataProvider> <mx:Array>
<mx:Object name="manish" colour="red" />
<mx:Object name="abdul" colour="blue" /> </mx:Array> </mx:dataProvider> </mx:DataGrid> <mx:Button label="Enter New Row"
click="enterNewRow()" /> </mx:Application> Note: 1. grid.addItem() will add a blank row 2. call focusNewRow() in the next frame
using doLater() 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/ Yahoo! Groups Links
|
- RE: [flexcoders] creating row in datagrid at runtime Doodi, Hari - BLS CTR
- RE: [flexcoders] creating row in datagrid at ru... Tracy Spratt
- RE: [flexcoders] creating row in datagrid at ru... Tracy Spratt
- RE: [flexcoders] creating row in datagrid at ru... Tracy Spratt

