admin管理员组文章数量:1405551
I have a typical tabulator setup with keybindings:{"navUp" :"38","navDown" :"40","navLeft" :"37","navRight" :"39"}
enabled.
When edit a cell it updates data successfully and moves programmatic in the next cell bellow
cellEdited:function(cell){
let updateValue = updateValueQuery(columnIndex,rowIndex,cell.getValue()).then(function(done){
cell.nav().down();
});
}
When in a new cell down, the rowId doesn't change (its behavior is not like rowClick)
What i'm trying to figure out is: How to get row.getIndex();
inside of cellEdited:function(cell){}
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();
});
}
I've tried to put row attribute in cellEdited:function(cell,row)
but without luck.
Any help will be appreciated! thank you for your time!
I have a typical tabulator setup with keybindings:{"navUp" :"38","navDown" :"40","navLeft" :"37","navRight" :"39"}
enabled.
When edit a cell it updates data successfully and moves programmatic in the next cell bellow
cellEdited:function(cell){
let updateValue = updateValueQuery(columnIndex,rowIndex,cell.getValue()).then(function(done){
cell.nav().down();
});
}
When in a new cell down, the rowId doesn't change (its behavior is not like rowClick)
What i'm trying to figure out is: How to get row.getIndex();
inside of cellEdited:function(cell){}
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();
});
}
I've tried to put row attribute in cellEdited:function(cell,row)
but without luck.
Any help will be appreciated! thank you for your time!
Share Improve this question edited Apr 28, 2021 at 5:29 George Gotsidis asked Apr 27, 2021 at 7:28 George GotsidisGeorge Gotsidis 4364 silver badges17 bronze badges1 Answer
Reset to default 6I'm not sure I understand your question but you can access the row through the cell ponent methods
var row = cell.getRow();
And you can also just get the data without going through the row:
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
Or use 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();
If you want to get the next or previous logical row, you can use the methods of the row ponent:
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();
And finally:
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
本文标签: javascriptHow to get row Index from cellEditedfunction(cell)TabulatorStack Overflow
版权声明:本文标题:javascript - How to get row Index from cellEdited:function(cell)? - Tabulator - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744278517a2598534.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论