0 Replies Latest reply on Aug 29, 2007 11:26 AM by Handycam

    ondataChange event from item editor?

    Handycam Level 1
      Hi. The docs are a bit confusing on this, so maybe someone can help.

      I've got a numeric stepper in a datagrid as an itemEditor:
      <mx:DataGridColumn dataField="@qty" headerText="Quantity" itemEditor="myComponents.NSEditor_max3" editorDataField="newTotal"/>

      I have a function that adds up all the data in this column. I would like to call that function every time the user changes the data, with the stepper arrows or by typing. Most of my users will click the arrows.

      I already can easily call the function if the user chooses a different row, or otherwise commits the data. However, I can't count on my users doing that; they might just leave the stepper in editing mode and leave the screen (it's in a view stack) so I want to get a total immediately when they change the amount. This happens by default with a "plain" stepper right on the screen, but it being an itemEditor seems to be different.

      Here's the stepper component code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="69" height="22">
      <mx:Script>
      <![CDATA[
      public function get newTotal ():Number{
      return step.value;
      }
      ]]>
      </mx:Script>
      <mx:NumericStepper id="step" minimum=".25" maximum="1" stepSize=".25" value="{XML(data).@qty}" />
      </mx:VBox>