简体   繁体   English

如何在Flash DataGrid(AS3)中设置选定的行

[英]how to set selected rows in flash datagrid (as3)

I want to select multiple rows in current result set in DataGrid in flash as3. 我想在Flash as3的DataGrid中的当前结果集中选择多行。 I tried to do it like that: 我试图这样做:

this.dataGrid.selectedItems = _selectedElements[index];

where _selectedElements is an array that holds results of prevoius selection on results page gathered like that: 其中_selectedElements是一个数组,用于保存按如下方式收集的结果页面上优先选择的结果:

_selectedElements[index] = this.dataGrid.selectedItems;

_selectedElements has correct values ( checked ) and I'm sure that the problem is with datagrid component. _selectedElements具有正确的值(已checked ),并且我确定问题出在datagrid组件上。

Does anybody have a clue how to make it work? 有人知道如何使它起作用吗?

I misunderstood you question first so I edited my answer. 我首先误解了您的问题,所以我编辑了答案。 You can set selected rows like this: 您可以像这样设置选定的行:

myDataGrid.selectedIndices = [3,4,5,6]; myDataGrid.selectedIndices = [3,4,5,6];

To select a multiple rows, you have to write a coding in for loop using rows and columns. 要选择多行,您必须使用行和列在for循环中编写代码。 And by giving count eg.rows+1, rows-1 you can access the rows. 通过计数,例如行+1,行1,您可以访问行。 same for column also. 列也一样。 pls try this and let me know if you have any doubt. 请尝试一下,如果您有任何疑问,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM