[flexcoders] Re: DataGrid edits with XMLListCollection dataprovider

2007-06-04 Thread arieljake

Thank you very much for the help! Here is what I wrote to solve this
problem:

private function handleItemEdit(event:DataGridEvent):void
{
event.preventDefault();

var itemData:XML = event.itemRenderer.data as 
XML;
var newData:Object =
itemEditorInstance[this.columns[event.columnIndex].editorDataField];

itemData.setChildren(newData);

this.destroyItemEditor();
}

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 The DG default code assumes that you are pulling properties for display
 and stuffing them on edit.  Your label functions are not simply property
 pullers so you'll need to customize an ITEM_EDIT_END handler, call
 preventDefault() and stuff it yourself.
 
  
 
 -Alex
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of arieljake
 Sent: Thursday, May 31, 2007 10:53 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: DataGrid edits with XMLListCollection
 dataprovider
 
  
 
 Update:
 
 I do not think this is something to be done with ItemRenderer or 
 ItemEditor. I have tracked this to the DataGrid itself. There is a 
 line there that says:
 
 data[property] = newValue;
 
 This leads to entries in the data like:
 
 fields
 field1
 textmy new value/text
 /field1
 /fields
 
 when the dataField=text
 
 OR
 
 fields
 field1
 nullmy new value/null
 /field1
 /fields
 
 when the dataField is empty.
 
 Text is not a property of an XML object, so there is no setter. And 
 setChildren does not work as a property, only a method.
 
 How else can one get the DataGrid to save the data like:
 
 fields
 field1my new value/field1
 /fields
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , Ariel Jakobovits arieljake@ 
 wrote:
 
  I have this file:
  
  fields
  field1value1/field1
  field2value2/field2
  /fields
  
  output in these columns:
  
  mx:columns
  mx:DataGridColumn headerText=Field width=100 
 editable=false labelFunction=getFieldLabel /
  mx:DataGridColumn headerText=Value editable=true 
 labelFunction=getValueLabel /
  /mx:columns
  
  with these label functions:
  
  private function getFieldLabel(data:Object, 
 column:DataGridColumn):String
  {
  return XML(data).localName().toString();
  }
  private function getValueLabel(data:Object, 
 column:DataGridColumn):String
  {
  return XML(data).text().toString();
  }
  
  Question: if I want to edit the value column, how do I set the text
 () property of an XML node?
 





[flexcoders] Re: DataGrid edits with XMLListCollection dataprovider

2007-05-31 Thread arieljake
Update:

I do not think this is something to be done with ItemRenderer or 
ItemEditor. I have tracked this to the DataGrid itself. There is a 
line there that says:

data[property] = newValue;

This leads to entries in the data like:

fields
  field1
textmy new value/text
  /field1
/fields

when the dataField=text

OR

fields
  field1
nullmy new value/null
  /field1
/fields

when the dataField is empty.

Text is not a property of an XML object, so there is no setter. And 
setChildren does not work as a property, only a method.

How else can one get the DataGrid to save the data like:

fields
  field1my new value/field1
/fields

--- In flexcoders@yahoogroups.com, Ariel Jakobovits [EMAIL PROTECTED] 
wrote:

 I have this file:
 
 fields
 field1value1/field1
 field2value2/field2
 /fields
 
 output in these columns:
 
 mx:columns
 mx:DataGridColumn headerText=Field width=100 
editable=false labelFunction=getFieldLabel /
 mx:DataGridColumn headerText=Value editable=true 
labelFunction=getValueLabel /
 /mx:columns
 
 with these label functions:
 
 private function getFieldLabel(data:Object, 
column:DataGridColumn):String
 {
 return XML(data).localName().toString();
 }
 private function getValueLabel(data:Object, 
column:DataGridColumn):String
 {
 return XML(data).text().toString();
 }
 
 Question: if I want to edit the value column, how do I set the text
() property of an XML node?





RE: [flexcoders] Re: DataGrid edits with XMLListCollection dataprovider

2007-05-31 Thread Alex Harui
The DG default code assumes that you are pulling properties for display
and stuffing them on edit.  Your label functions are not simply property
pullers so you'll need to customize an ITEM_EDIT_END handler, call
preventDefault() and stuff it yourself.

 

-Alex

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of arieljake
Sent: Thursday, May 31, 2007 10:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DataGrid edits with XMLListCollection
dataprovider

 

Update:

I do not think this is something to be done with ItemRenderer or 
ItemEditor. I have tracked this to the DataGrid itself. There is a 
line there that says:

data[property] = newValue;

This leads to entries in the data like:

fields
field1
textmy new value/text
/field1
/fields

when the dataField=text

OR

fields
field1
nullmy new value/null
/field1
/fields

when the dataField is empty.

Text is not a property of an XML object, so there is no setter. And 
setChildren does not work as a property, only a method.

How else can one get the DataGrid to save the data like:

fields
field1my new value/field1
/fields

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Ariel Jakobovits [EMAIL PROTECTED] 
wrote:

 I have this file:
 
 fields
 field1value1/field1
 field2value2/field2
 /fields
 
 output in these columns:
 
 mx:columns
 mx:DataGridColumn headerText=Field width=100 
editable=false labelFunction=getFieldLabel /
 mx:DataGridColumn headerText=Value editable=true 
labelFunction=getValueLabel /
 /mx:columns
 
 with these label functions:
 
 private function getFieldLabel(data:Object, 
column:DataGridColumn):String
 {
 return XML(data).localName().toString();
 }
 private function getValueLabel(data:Object, 
column:DataGridColumn):String
 {
 return XML(data).text().toString();
 }
 
 Question: if I want to edit the value column, how do I set the text
() property of an XML node?