Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Adobe Flex SDK 3.1 (Release)
-
None
-
None
-
Affected OS(s): Windows
Browser: Firefox 3.x
Language Found: English
Description
When using a NumericStepper as an itemEditor in a DataGrid, if the "maximum" property is set to a value from the data provider, a stack overflow will occur. This is happening because of this code in the NumericStepper:
public function get data():Object
{ if (!_listData) data = this.value; return _data; }When the NumericStepper is instantiated, a call is made to "get data()" to get the "maximum" value. "listData" has not been set so "set data()" is called. This dispatches an event that will again call "get data()" with no value in "listData" resulting in an infinate loop. Eventually the stack overflows.
I would think the solution is to replace "data = this.value" with "_data = this.value" in the above code. This is how I solved it and everything works great.
While I only tested for this case and there may be some cases where this suggestion would cause a problem, It would seem to me that triggering a "dataChanged" event on a "get data()" call is not desired.
Steps to reproduce:
Run this code and tab to the first editable column in the datagrid:
<mx:DataGrid width="100%" height="100%" editable="true" selectable="false">
<mx:dataProvider>
<mx:Array>
<mx:Object ordered="10" delivered="5" fill="0"/>
<mx:Object ordered="10" delivered="5" fill="0"/>
<mx:Object ordered="10" delivered="5" fill="0"/>
</mx:Array>
</mx:dataProvider>
<mx:columns>
<mx:DataGridColumn editable="false" headerText="Ordered" dataField="ordered"/>
<mx:DataGridColumn editable="false" headerText="Delivered" dataField="delivered"/>
<mx:DataGridColumn editable="true" headerText="Deliver" dataField="fill" editorDataField="value">
<mx:itemEditor>
<mx:Component>
<mx:NumericStepper minimum="0" maximum="
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
Actual Results:
Stack overflow.
Expected Results:
"fill" column maximum value is "ordered-delivered".
Workaround (if any):
Change the itemEditor as follows:
<mx:itemEditor>
<mx:Component>
<mx:NumericStepper minimum="0" maximum="{data.ordered-data.delivered}
">
<mx:Script>
<![CDATA[
/* Must include the Bindable annotation which requires the setter be defined, also. */
[Bindable] public override function get data():Object
public override function set data(d:Object):void
{ super.data = d; } ]]
>
</mx:Script>
</mx:NumericStepper>
</mx:Component>
</mx:itemEditor>