如何动态更改数据网格单元格的 itemRenderer
我有一个简单的数据网格,有两列,分别命名为图像和位置。其中图像列有 mx.controls.Image itemRenderer 并且位置很简单。我的要求是在单击图像单元时更改图像单元的 itemRenderer 。我的意思是说,当用户单击图像列中的任何图像时,我想以可编辑模式显示该图像路径,并且当用户编辑该路径时,所选单元格将开始显示更新的图像。
我不知道该怎么做并且变得沮丧。请任何人帮助我! :(
i have a simple datagrid having 2 columns named as image and place. where image column has mx.controls.Image itemRenderer and place is simple. my requirement is to change itemRenderer of image cell when it will be clicked. i means to say when user click on any image from image column than i want to show that image path in editable mode and when user edit that path then the selected cell will start displayed the updated image.
i dont know how to do this and getting depressed . please anyone help me ! :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要为此更改 itemRenderer - 只需在单个项目渲染器中实现该代码即可。您可以在其中添加侦听器并更改当前单元格的内容。
You don't need to change itemRenderer for that - just implement that code in your single item renderer. You can add listeners inside it and change the contents of the current cell.
我建议当您的 DataGrid 进入可编辑模式时:同时为您的 Image 列创建一个 itemEditor,使其成为一个扩展的 TextInput 类。当您完成编辑(“itemEditEnd”事件)时,此扩展的 TextInput 类将更改数据对象的 imageAddress/url。
请告诉我这是否有帮助,谢谢!
I suggest when going into editable mode for your DataGrid: Also create an itemEditor for your Image column, make it an extended TextInput class. This extended TextInput class will change the data object's imageAddress/url when you are done editing ("itemEditEnd" event).
Let me know if this helps, thanks!