0

我有一个包含行数和列数的 flex 数据网格。我想通过单击编辑按钮使选定的行可编辑。可能吗?我尝试了很多示例,但要么整个数据网格是可编辑的,要么特定行的单列是可编辑的。有没有办法通过单击编辑按钮使选定的行可编辑?

4

1 回答 1

0

您可以使用 grid.selectedIndex 属性获取选定的行。一个想法给你的问题:

Add an "editable" property to you items in the datagrid which is false by default
When clicking on the button, set grid.selectedItem.editable = true;
Change the grid's item renderer to a new one, which displays TextInput fields if an item is editable or just plain Label if it's not

您可以像这样在运行时更改项目渲染器:

grid.itemRenderer = new ClassFactory(com.myapp.renderers.MyGridItemRenderer);

于 2013-01-09T09:24:28.203 回答