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
the onClick
event passes the row as an argument
function cellClicked(e, args) {
var item = grid.getDataItem(args.row);
}
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");
});
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With