如何从 cellEdited:function(cell) 获取行索引? - 制表符
How to get row Index from cellEdited:function(cell)? - Tabulator
我有一个启用了 keybindings:{"navUp" :"38","navDown" :"40","navLeft" :"37","navRight" :"39"}
的典型制表符设置。
编辑单元格时,它会成功更新数据并在下面的下一个单元格中以编程方式移动
cellEdited:function(cell){
let updateValue = updateValueQuery(columnIndex,rowIndex,cell.getValue()).then(function(done){
cell.nav().down();
});
}
在新的单元格中,rowId 没有改变(它的行为不像 rowClick)
我想弄清楚的是:如何在 cellEdited:function(cell){}
中获取 row.getIndex();
cellEdited:function(cell){
// ->> How i can obtain rowIndex = row.getIndex(); here or if there is another more optimal way.
let updateValue = updateValueQuery(columnIndex,rowIndex,cell.getValue()).then(function(done){
cell.nav().down();
});
}
我尝试将行属性放入 cellEdited:function(cell,row)
但没有成功。
任何帮助将不胜感激!
感谢您的宝贵时间!
我不确定我是否理解您的问题,但您可以通过 cell component 方法访问该行
var row = cell.getRow();
你也可以直接获取数据而不用遍历行:
Get Data
The getData function returns the data for the row that contains the
cell.
var dataID = cell.getData().id;
// the name of the property you are using for the index
或使用getIndex
Get Index
The getIndex function returns the index value for the row. (this is
the value from the defined index column, NOT the row's position in the
table)
var rowIndex = row.getIndex();
如果想获取下一个或上一个逻辑行,可以使用row component:
的方法
Get Next Row
The getNextRow function returns the Row Component for the next visible
row in the table, if there is no next row it will return a value of
false.
var nextRow = row.getNextRow();
var prevRow = row.getPrevRow();
最后:
Get Position
Use the getPosition function to retrieve the numerical position of a
row in the table. By default this will return the position of the row
in all data, including data currently filtered out of the table.
If you want to get the position of the row in the currently
filtered/sorted data, you can pass a value of true to the optional
first argument of the function.
var rowPosition = row.getPosition(true);
//return the position of the row in the filtered/sorted data
我有一个启用了 keybindings:{"navUp" :"38","navDown" :"40","navLeft" :"37","navRight" :"39"}
的典型制表符设置。
编辑单元格时,它会成功更新数据并在下面的下一个单元格中以编程方式移动
cellEdited:function(cell){
let updateValue = updateValueQuery(columnIndex,rowIndex,cell.getValue()).then(function(done){
cell.nav().down();
});
}
在新的单元格中,rowId 没有改变(它的行为不像 rowClick)
我想弄清楚的是:如何在 cellEdited:function(cell){}
row.getIndex();
cellEdited:function(cell){
// ->> How i can obtain rowIndex = row.getIndex(); here or if there is another more optimal way.
let updateValue = updateValueQuery(columnIndex,rowIndex,cell.getValue()).then(function(done){
cell.nav().down();
});
}
我尝试将行属性放入 cellEdited:function(cell,row)
但没有成功。
任何帮助将不胜感激! 感谢您的宝贵时间!
我不确定我是否理解您的问题,但您可以通过 cell component 方法访问该行
var row = cell.getRow();
你也可以直接获取数据而不用遍历行:
Get Data
The getData function returns the data for the row that contains the cell.
var dataID = cell.getData().id;
// the name of the property you are using for the index
或使用getIndex
Get Index
The getIndex function returns the index value for the row. (this is the value from the defined index column, NOT the row's position in the table)
var rowIndex = row.getIndex();
如果想获取下一个或上一个逻辑行,可以使用row component:
的方法Get Next Row
The getNextRow function returns the Row Component for the next visible row in the table, if there is no next row it will return a value of false.
var nextRow = row.getNextRow();
var prevRow = row.getPrevRow();
最后:
Get Position
Use the getPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table.
If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional first argument of the function.
var rowPosition = row.getPosition(true);
//return the position of the row in the filtered/sorted data