Hey all.  I have a numeric stepper and would like to set the max value
from another data.field.  Certainly there are dozens of code-around
fixes for problems like these, but it seems like this should work:
(I'm copying and pasting code form a project I'm working on and with
the init function I'm replicating data in the fashion that it comes
back from a different team of developers)

[Bindable]
public var arrayCol : ArrayCollection = new ArrayCollection();

private function initHandler():void
{
        var i : int;
        var objArray : Array = new Array();
        
        for(i=0; i < 10  ; i++ )
        {
          objArray.push( {QTY_TO_ISSUE:0,
QTY_ON_HAND:Math.round(Math.random()*50) } );
        }
        
        this.arrayCol = new ArrayCollection(objArray);
}

]]>
</mx:Script>


<mx:DataGrid id="test" dataProvider="{arrayCol}" height="50%">
<mx:columns>
<mx:DataGridColumn dataField="QTY_ON_HAND"
headerText="{ULang.Current.getString('On Hand')}" />
<mx:DataGridColumn dataField="QTY_TO_ISSUE" headerText="To Issue" 
        sortable="false" editable="true" editorDataField="value"
rendererIsEditor="true" >
        <mx:itemRenderer>
        <mx:Component>
        <mx:NumericStepper maximum="{ getMaxValue(data) }" minimum="0">
                <mx:Script>
                <![CDATA[
                        
                        private function getMaxValue(obj:Object=null):Number
                        {
                        if(data)
                                return data['QTY_ON_HAND'];
                                                        
                        return 0;
                        }
                                                
                ]]>
                </mx:Script>
        </mx:NumericStepper>
        </mx:Component>
        </mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>


it looks like 'data' isn't defined, or some such thing, but an inline
if statement to check if data exists doesn't seem to help.  Any ideas?

Reply via email to