admin管理员组文章数量:1221313
i'm working with slickgrid and i'm quit new in slickgrid. i want to know is there any function through which i can get the complete info of all the cell to a specific row where user will click ??? also i want to get values before and after editing in the specific cell so that i can measure the change in the cell. for getting the active cell (i.e. where user clicked) i'm using
ifkaar_scenarioConfigTable.onClick.subscribe(cellClicked);
and i'm checking where the cell is my desired cell(i.e. where user is allowed to do editing/modification) as following
function cellClicked(e) {
var cell = ifkaar_scenarioConfigTable.getCellFromEvent(e);
if (col[cell.cell].id == "orderqty") {
console.log("orderqty pressed");
}
}
this is working fine , i.e. when i click on any cell , it tell whether it is "orderqty" or not , but further i want to get its value and other cells' value in order to calculate the changes. I've searched but couldn't find any clear article (or i can't understood properly). any help will be highly appreciated. Thanks
i'm working with slickgrid and i'm quit new in slickgrid. i want to know is there any function through which i can get the complete info of all the cell to a specific row where user will click ??? also i want to get values before and after editing in the specific cell so that i can measure the change in the cell. for getting the active cell (i.e. where user clicked) i'm using
ifkaar_scenarioConfigTable.onClick.subscribe(cellClicked);
and i'm checking where the cell is my desired cell(i.e. where user is allowed to do editing/modification) as following
function cellClicked(e) {
var cell = ifkaar_scenarioConfigTable.getCellFromEvent(e);
if (col[cell.cell].id == "orderqty") {
console.log("orderqty pressed");
}
}
this is working fine , i.e. when i click on any cell , it tell whether it is "orderqty" or not , but further i want to get its value and other cells' value in order to calculate the changes. I've searched but couldn't find any clear article (or i can't understood properly). any help will be highly appreciated. Thanks
Share Improve this question asked Oct 31, 2013 at 7:58 Omar BahirOmar Bahir 1,2575 gold badges21 silver badges50 bronze badges3 Answers
Reset to default 14the onClick
event passes the row as an argument
Get the data item for a clicked row
function cellClicked(e, args) {
var item = grid.getDataItem(args.row);
}
Check if a click happened in a specific column
function cellClicked(e, args) {
if (args.cell == grid.getColumnIndex('orderqty')) {
console.log("orderqty pressed");
}
}
You could even pull this filtering functionality out into its own function and pass a callback when a click happens in that column
function forColumn(row, cell, columnID, fn) {
var cellNode = grid.getCellNode(row, cell);
var dataContext = grid.getDataItem(row);
if (cellNode && grid.getColumns()[cell].id === columnID) {
fn.call(this, cellNode, dataContext, row, cell);
}
}
function cellClicked(e, args) {
forColumn(args.row, args.cell, 'orderqty', function (cellNode, dataContext, row, cell) {
console.log("orderqty pressed");
});
}
Values before and after edit
To get the values of a cell before and after an edit you will need to handle this in the isValueChanged
function in the editor for a column.
function cellClicked(e) {
var grid = ifkaar_scenarioConfigTable;
var cell = grid.getCellFromEvent(e);
var item = grid.getDataItem(cell.row); // all the data in the row
if (cell.cell == grid.getColumnIndex('orderqty')) {
console.log("orderqty pressed");
}
}
If you access grid from other control like . click button
var selectRow = gridInstance.getSelectedRows();
alert(gridInstance.getDataItem(selectRow).columnName)
本文标签: javascriptSlickgrid getting selected cell valueid and fieldStack Overflow
版权声明:本文标题:javascript - Slickgrid- getting selected cell value , id and field? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739255436a2155111.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论