Title: Problem with getEditingData() method in dataProvider
getEditingData does essentially:
 
function getEditingData ( index , fieldName )
{
    return    dataProviderArray [ index ] . fieldName;
}
 
So, maybe you want to try:
 
var item:Object = dataProvider.getItemAt(0);
var data:Object = item.getItemAt(4);
 
GetEditingData, at least when I used it, was used for RecordSets and flat objects I got back, like so:
 
someArray = [
                        {label: "One", data: 1},
                        {label: "Two", data: 2},
                        {label: "Three", data: 3}];
 
 
var value = someArray.getEditingData(1, "data");
trace(value); // 2
 
 
----- Original Message -----
Sent: Wednesday, October 19, 2005 10:18 AM
Subject: [flexcoders] Problem with getEditingData() method in dataProvider

Hi,

I have a question about getEditingData() method in dataProvider. I have a datagrid as below. My model has a two dimensional String array called columnarSpec which I give to the dataProvider of my datagrid. The data in the datagrid is displayed fine.

But when I try to access a cell value from the datagrid using getEditingData() method, the result is undefined. If I use the indexes on the dataProvider i.e. columnar_dg.dataProvider[1][4], it displays the cell value correctly.

Can anyone please tell me why the getEditingData method does not return the cell value? What am I doing wrong here.

<mx:Script>
<![CDATA[
function cellEdit(event:Object):Void
{
        trace("event.itemIndex: "+event.itemIndex);
        trace("event.columnIndex: "+event.columnIndex);

        trace("Data 1: "+columnar_dg.dataProvider.getEditingData(1, "C"));  -- Result Undefined
        trace("Data 2: "+columnar_dg.dataProvider[0][4]);                              -- Result correct
        trace("Data 3: "+columnar_dg.dataProvider[1][4]);                   -- Result correct
}
]]>
</mx:Script>

<mx:Model id="listSpec">
        <id></id>
        <name></name>
        <columnarSpec></columnarSpec>
</mx:Model>

<mx:Form>
  <mx:FormItem label="Spec:" >   
        <mx:DataGrid id="columnar_dg" dataProvider="{listSpec.columnarSpec}" cellPress="cellEdit(event)"/>
  </mx:FormItem>
</mx:Form>   


Thanks,
Shweta



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