高级数据网格:在网格 mxml 标记中设置各个列的属性
是否可以控制“advanceddatagrid”mxml 标记中“advancedgridcolumns”的属性。例如,假设网格数据提供者有 3 个不同的字段。在这 3 个字段中,有一个字段是“to_be_decided”。该字段最初不应显示。仅应显示剩余的 2 列(visible true),而第三列(数据字段为“to_be_decided”的一列,此处可见标志将为 false)应隐藏。当某些事件(例如单击按钮或某些事件)被触发时,它将可见。
我们可以通过访问网格的各个列并采取适当的操作,在动作脚本编码中做到这一点。但是在 mxml 中可以这样做吗?网格中有一些默认属性可以在这里使用吗?
在 mxml 中,我无法在网格中(在标签下)单独访问它们,因此我无法为每个单独设置可见属性。要将它们一一添加到“列”标签中,我需要知道数组集合中的数据字段,而我不知道。只有已知的数据字段是“to_be_decided”,其余两个字段会不时变化。因此,即使我在“列”标签中添加了这个网格列,其他两个又如何呢?
像这样的:
<mx:columns>
<mx:AdvancedDataGridColumns dataField='to_be_decided' visible=false>
<!-- How to add other 2 columns here ? -->
</mx:columns>
在这方面有什么建议/想法吗?
如果我未能说清楚,请告诉我,我会尝试重新组织我的问题。 提前致谢。
Is it possible to control the properties of 'advancedgridcolumns' in 'advanceddatagrid' mxml tag. For e.g. suppose the grid data provider has 3 different fields. Out of these 3 fields, one field is 'to_be_decided'. This field should not be displayed initially. Only the remaining 2 columns should be displayed (visible true) and the third column (one with data field as 'to_be_decided', visible flag will be false here ) should be hidden. It will be visible when some event like a button click or something is fired.
We can do this in action script coding by accessing individual columns of grid and taking appropriate actions. But will it be possible to do so in mxml? Is there some default property in grid that can be used here ?
In mxml I can not access them individually in the grid (under tag) and hence I can not set the visible attributes individually for each of them. To add them one by one in 'columns' tags I would be required to know the data field in array collection and that I dont know. Only data field known is 'to_be_decided', rest two fields will vary time to time. Therefore even if I addd this one gridcolumn in 'columns' tag what about the other two?
Something like this :
<mx:columns>
<mx:AdvancedDataGridColumns dataField='to_be_decided' visible=false>
<!-- How to add other 2 columns here ? -->
</mx:columns>
Any suggestions/ideas in this regard?
If I failed to make myself clear please let me know I will try to reframe my question.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试
将 dataProvider (yourArrayCollection) 设为具有属性“fieldName”(字符串)和“show”(布尔值)的对象的 ArrayCollection。
You could try
where your dataProvider (yourArrayCollection) is an ArrayCollection of objects with properties "fieldName" (String) and "show" (Boolean).