1

In selected data and other properties events and methods I get a rows[] object.

  1. How do I access a certain cell in that row. Can I use the column index?
    e.g. for column 2 (starting with zero) can I write: var text = rows[5][2]?

  2. Can I somehow get the cell by the row number and column id?

  3. Can I somehow get the column index from its id?

I can get the columnid from the getColumnHeaders()... but:

  1. Can I somehow get the column NAME (as set in the html) from its id or index?
4

1 回答 1

0

如果你得到一个Array行,你可以通过它的索引访问一个特定的行,通过它的列标识符访问一个单元格。

访问单行:

var row = rows[0];

访问第一行的特定单元格:

var cell = rows[0]["column-id"];

如果您需要访问列,您可以Array通过 方法请求列的getColumnSettings。请参见下面的示例:

var columns = $("#grid").bootgrid("getColumnSettings");

顺便说一句,该列与您的HTMLArray表格列的列具有相同的顺序,因为它们链接到它们。

这是完整的示例:

var columns = $("#grid").bootgrid("getColumnSettings");
var firstColumn = columns[0];
var cell = rows[0][firstColumn.id];
于 2015-09-11T08:59:06.347 回答