为 dataGrid 中的组件提供值

发布于 2024-07-26 22:42:03 字数 596 浏览 2 评论 0原文

我有以下内容。 :

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

如何将数据提供者(这是一个对象数组)中的值提供给这些单独的数字步进器。 似乎在 NumericStepper 标签中无法提及 dataField 。

帮助。

PN :忽略 mxml 的开始标记和结束 tgs。 问题未正确显示。

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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黎夕旧梦 2024-08-02 22:42:03

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

If I'm not misstaken you can access the data like this: < mx:NumericStepper value="{data.yourValue}" />

云淡月浅 2024-08-02 22:42:03

绑定警告永远都不应被忽略。 他们告诉您,您尝试在运行时使用的属性实际上是可绑定的,并且对其值的更改将不会被传播,即您不会在视图中看到数据的更改。 由于 itemRenderers 实例被回收,因此,当用户滚动列表、网格等时,它们的数据属性会重复更改。您基本上不会得到您想要的。

您必须在这里做几件事。 首先,确保您要提供给网格的 ArrayCollection 中的对象本身是 [Bindable],或者至少您要显示的属性是 [Bindable]。

其次,我猜您希望步进器实例也修改这些值。 您应该阅读标题为“创建项目渲染器和项目编辑器”的文档部分,以获取您想要执行的操作的示例。

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 i.e. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文