简体   繁体   中英

Providing values to components in a dataGrid

I have the follwoing. :

mx:DataGridColumn width="125"  headerText="Time" editable="false"
mx:itemRenderer
mx:Component
            mx:HBox
                   mx:NumericStepper id ="TimeHour"    stepSize="1" minimum="0" value="0" maximum="23"/
                   mx:NumericStepper id ="TimeMinute"  stepSize="5" minimum="0" value="0"  maximum="55"/
            /mx:HBox
                    /mx:Component
   /mx:itemRenderer
/mx:DataGridColumn

How do I provide values from the dataprovider (which is an array of objects) to these individual numeric steppers. dataField cannot be mentioned in the NumericStepper tag it seems.

Help.

PN : IGNORE Start tag and End tgs of the mxml. Question is not being displayed correctly.

如果我没记错的话,可以这样访问数据:<mx:NumericStepper value =“ {data.yourValue}” />

Binding warnings should never be ignored. They're telling you that the property you're trying to use at runtime is actually bindable and changes to its value will not be propagated ie you won't see changes to data in the view. Since itemRenderers instances are recycled, and thus, have their data properties changed repeatedly as the user scrolls the list, grid, etc. you basically won't get what you want.

There's a couple of things you have to do here. First, make sure the objects in your ArrayCollection that you're feeding to the grid are themselves [Bindable] or that at least the properties you want to display are [Bindable].

Secondly, I'm guessing that you want the stepper instances to also modify the values. You should read the documentation section entitled "Creating an item renderer and item editor" for an example of what you're trying to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM