flex advanceDatagrid 与单选按钮问题

发布于 2024-09-10 22:05:52 字数 1454 浏览 2 评论 0原文

我正在使用 Flex 3 的高级 DataGrid 和分层数据 我还在另一列中添加了图块列表作为项目渲染器 在该图块列表中,我添加了单选按钮作为项目渲染器 如果我更改单选按钮的值,层次树就会展开 如果滚动条出现,则单选按钮的值正在改变

<mx:AdvancedDataGrid contextMenu="{cm}" backgroundAlpha="0" styleName="TreeUser" dataProvider="{modelInstance._treeUserXml}" 
id="treeAdg" width="100%" height="100%" showHeaders="false" doubleClick="treeDoubleClick(event)" doubleClickEnabled="true" 
displayItemsExpanded="false" click="onItemClick(event)" borderStyle="none" rowHeight="25">
<mx:columns>
    <mx:AdvancedDataGridColumn dataField="name"/>
    <mx:AdvancedDataGridColumn id="treeItem" itemRenderer="com.Frontend.views.TreeUser.TreeStructureTileList"/>
</mx:columns>

这是高级数据网格,添加分层数据作为数据提供程序

<containers:TileListEx id="tileList" width="100%" height="100%" textAlign="left"
    horizontalScrollPolicy="off" verticalScrollPolicy="off" direction="horizontal"
    dataProvider="{data.driver}" itemClick="tileItemClick(event)"
    backgroundAlpha="0" borderStyle="none" paddingLeft="0" paddingTop="0"
    useRollOver="false" rowHeight="25" itemRenderer="com.Frontend.views.TreeUser.tieListRenderer">
</containers:TileListEx>

,这是我添加 data.driver 作为 dataprovider

如果我单击单选按钮,其值会发生变化,但如果滚动,该值将随机变化,因为 itemrenderer 帮助我解决了这个问题

I am using Advanced DataGrid of Flex 3 with hierarchical data
and also i added tile list as a item renderer in another column
in that tile list i added radiobutton as item renderer
if i change the radio selected value the hierarchical tree sould expand
if the scroll bar will come the radio button value is changing

<mx:AdvancedDataGrid contextMenu="{cm}" backgroundAlpha="0" styleName="TreeUser" dataProvider="{modelInstance._treeUserXml}" 
id="treeAdg" width="100%" height="100%" showHeaders="false" doubleClick="treeDoubleClick(event)" doubleClickEnabled="true" 
displayItemsExpanded="false" click="onItemClick(event)" borderStyle="none" rowHeight="25">
<mx:columns>
    <mx:AdvancedDataGridColumn dataField="name"/>
    <mx:AdvancedDataGridColumn id="treeItem" itemRenderer="com.Frontend.views.TreeUser.TreeStructureTileList"/>
</mx:columns>

this is advanced data grid adding hierarchical data as a data provider

<containers:TileListEx id="tileList" width="100%" height="100%" textAlign="left"
    horizontalScrollPolicy="off" verticalScrollPolicy="off" direction="horizontal"
    dataProvider="{data.driver}" itemClick="tileItemClick(event)"
    backgroundAlpha="0" borderStyle="none" paddingLeft="0" paddingTop="0"
    useRollOver="false" rowHeight="25" itemRenderer="com.Frontend.views.TreeUser.tieListRenderer">
</containers:TileListEx>

and this is the tile list where i added data.driver as a dataprovider<mx:RadioButton id="radio" label="{data.name}" click="checkClick(event)" width="100%"/>

if i click the radio button value its changing but if scroll will come the value will changing randomly because of itemrenderer help me to resolve this problem

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

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

发布评论

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

评论(1

情独悲 2024-09-17 22:05:52

您面临的问题很简单,作为 itemRenderer 实例创建的组件可以在 TileList 中重用。因此,如果您单击作为列表第一项的 itemRenderer 的 RadioButton,然后向下滚动,则单击的 RadioButton(由于滚动而消失)将用作出现的其中一个项目的 itemRenderer。您要做的就是使您的 itemRenderer 以某种方式依赖于“data”属性,例如向其添加“selected”属性,并在 data.selected==true 时将 RadioButton 显示为选中状态。您还需要在 RadioButton 单击处理程序中将 selected 设置为适当的值。

The problem you're facing is simply that the components created as instances of itemRenderer are reusable across your TileList. So if let's say you click RadioButton that is itemRenderer of first item of the List and then you scroll down, the clicked RadioButton (that dissapeared due to scrolling) will be used as itemRenderer of one of the items that appeared. What you have to do is make your itemRenderer somehow dependent on 'data' property, like adding 'selected' property to it for example and displaying RadioButton as checked if data.selected==true. You also need to set selected to appropriate value in your RadioButton click handler.

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