views:

1300

answers:

3

I have to put 2 numeric stepper components in one column of a datagrid. I suppose I need to write my own item renederer code for that. How to write a code for putting 2 numeric stepper components in one coulmn of datagrid.

The 2 numeric steppers would work as time (Hour and Min) components. I cannot use readily availabel time components, and hence have to write something of the above for my own time component.

+1  A: 

That correct, you need to create an item renderer. With Flex, this is relatively easy.

Here is an article on how to do it.

Zack
I have read that documentation. But, it does not specifically mention of how to go about for 2 numeric stepper components. can you help with some code ?
Also, is it anyways possible to have "00" "00" in numeric stepper ?
I could insert 2 numeric stepper components in a row. I have following issues :1> The numeric stepper does not get displayed unless row is clicked.2> The component is being displayed only for first row, inspte of having many other rows.3> Can we have "00" and "00" in the numeric stepper.
4> Since, it is a time component, I have to increment minutes by 5, now, it goes fine from 0-5-10-15-20-15......but, I keep max 59, inorder that it loops back to 0 instead of showing 60, but it displays 59. can we loop back in the numeric stepper value, so that after 55-00 is available ?please help me sort above issues. Please
+1  A: 

Try something like this

<mx:DataGridColumn headerText="Unit Price" dataField="price">
    <mx:itemRenderer>
     <mx:Component>
            <mx:NumericStepper ... />
            <mx:NumericStepper ... />
     </mx:Component>
    </mx:itemRenderer>
</mx:DataGridColumn>

Or you could set the itemRenderer to a custom component

I.E.

<mx:DataGridColumn itemRenderer="com.myComponent" headerText="Unit Price" dataField="price">

(note you might need {com.myComponent} ... not sure on the syntax, just going off memory)

For your specific example I would probably create my own component with a mask like ##:## then use that as the item renderer.

Chris Klepeis
A: 

Peter Ent's series on itemRenderers is a MUST for any Flex developer.

Joel Hooks