Hi,
I'm having some trouble with a datagrid item editor and renderer. I
think I must have missed something obvious.
I have a datagrid with editable cells which are bound to Number-like
properties of an object. I want to display these values using the
CurrencyFormatter. I want to edit these as Numbers without the dollar sign.
I am trying to make these renders/editors "lightweight" because the grid
has a lot of columns and rows(its basically a spreadsheet) so i'm trying
to use actionscript to extend rather than using composition and
containers in MXML.
I have an item editor that extends TextInput.
I have a renderer that extends Label.
The renderer displays its value correctly as $100.00.
The editor updates the property of the object when I mouse click outside
of the cell.
My gridcolumn has:
dataField="columnOne"
itemEditor="path.to.editor"
itemRender="path.to.renderer"
editorDataField="newValue"
newValue is a function of my editor that returns the updated value, it
seems to be doing the right thing as I can see the value updated in the
set function of my object.
I'm not really sure what my render should look like code-wise. I have
something like the following at the moment.
class renderer extends Label{
public function set data(value:Object):void{
if (value != null){
super.data = value;
text = formatter.format(text);
}
}
}
Any ideas where Ive gone wrong or what I might have missed?
cheers,
shaun