Hi Iain,
You need to update the grid's data field in your change handler. Try
the following:
var listOwner : MovieClip; // the reference we receive to the list
var getCellIndex : Function; // the function we receive from the list
var getDataLabel : Function; // the function we receive from the list
function changeVal() {
val = changed.value;
listOwner.editField(getCellIndex().itemIndex, getDataLabel(),
val);
}
Relevant links:
http://weblogs.macromedia.com/pent/archives/2004/12/cell_renderers.cfm
<http://weblogs.macromedia.com/pent/archives/2004/12/cell_renderers.cfm>
http://weblogs.macromedia.com/pent/archives/flex/solutions/cellrenderers\
.zip
<http://weblogs.macromedia.com/pent/archives/flex/solutions/cellrenderer\
s.zip> (source)
--- In [email protected], "digital_eyezed" <[EMAIL PROTECTED]>
wrote:
>
> Hi all,
>
> I have a problem with a numeric stepper in a cellrenderer of a
> dataGridColumn.
>
> When the cell loses focus, it goes back to the value set initially, so
> I lose all the changes.
>
> Here is the cellrenderer code:
>
> <mx:HBox horizontalAlign="center" width="100%"
> xmlns:mx="http://www.macromedia.com/2003/mxml">
> <mx:Script>
> <![CDATA[
>
> var labelData:Object;
> var val;
>
> function setValue(str:String, item:Object) {
> if (item == undefined){
> visible = false;
> return;
> }
> visible = true;
> var s = item;
> labelData = s;
> val = labelData.levels;
> }
> function changeVal(){
> val = changed.value;
> }
> ]]>
> </mx:Script>
> <mx:NumericStepper id="changed" value="{val}" change="changeVal()"
> maximum="{labelData.fill}"/>
> </mx:HBox>
>
> I need the numericStepper to keep the value I change it to in each of
> the rows I change it.
>
> Cheers,
>
> Iain
>