简体   繁体   English

为dataGrid中的组件提供值

[英]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. 似乎在NumericStepper标记中无法提及dataField。

Help. 救命。

PN : IGNORE Start tag and End tgs of the mxml. PN:IGNORE mxml的开始标记和结束tgs。 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. 由于itemRenderers实例被回收,因此当用户滚动列表,网格等时,其数据属性会重复更改。基本上,您将无法获得所需的内容。

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]. 首先,确保要馈入网格的ArrayCollection中的对象本身是[Bindable],或者至少要显示的属性是[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. 您应阅读标题为“创建项目渲染器和项目编辑器”的文档部分,以获取有关您要执行的操作的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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