Select 使用制表符 selectRow 方法以编程方式一行

Select a row programmatically using tabulator selectRow method

我正在使用制表符在我的网站上创建表格。我可以通过单击 select 行,我可以使用 tabulator.selectRow() 方法 select 所有行。

According to the documentation:

To select a specific row you can pass the any of the standard row component look up options into the first argument of the function.

我已经看过几次了,但是没有有效的例子。有人知道需要如何提供行组件查找选项吗?

假设我有包含名称字段的行。

我想要 select 名称 == 'dennis' 的行。

文档建议我可以在 selectRow() 参数中传递查找选项。对于参数的预期语法,没有示例或任何指示。

我目前的工作方式似乎不是最直观的方式。

table.getRows().forEach(row => {
  if (row.getData().name == 'dennis') row.toggleSelect();
});

或者像这样:

params.layer.tableView.table.getRows()
    .filter(row => row.getData().name == 'dennis')
    .forEach(row => row.toggleSelect());

在 github 的帮助下,我最终到达了那里。 #1749

为我解决这个问题的一点是:

Any function that takes a component as an argument will also attempt to find that component based on the value provided if it is not a component itself.

这里以 select 我的行为例。

table.selectRow(table.getRows().filter(row => row.getData().name == 'Dennis'));