Hi,
i want to change value in row cell 'WSALQT', that is an input text, but doesn't work. The value must change on press 'Enter' and row['WSALQT'] change with 'allocable' variable.
Below i share you my function
MMS120_SaveOverAllocation.prototype.onRequesting = function (args) {
this.log.Info("onRequesting");
console.log(args);
if (args.commandType === "KEY" && args.commandValue === "F12") {
return; // The user should be allowed to go back
}
if (args.commandType === "KEY" && args.commandValue === "ENTER") {
var datagrid = args.controller.GetGrid();
var columns = datagrid.getColumns();
var dataset = datagrid.getData();
var quantityAvaible = parseInt(ScriptUtil.GetFieldValue("WXORQT"));
var rowChanged = this.SearchChanged(args.controller.GetGrid().getData());
console.log('Righe modificate');
console.log(rowChanged);
var newDataset = [];
dataset.forEach((row, i)=>{
if(rowChanged.find((idx)=> idx == i)){
var newRow = JSON.parse(JSON.stringify(row));
var allocated = parseInt(newRow.WSALQT);
var allocable = parseInt(newRow.S1STQT);
console.log('Quantita allocata: ' + allocated);
console.log('Quantita allocabile: ' + allocable);
if(allocated > 0 && allocated > allocable){
newRow[this.cusColumn] = allocated;
newRow['WSALQT'] = allocable.toString();
newDataset.push(newRow);
}
} else {
newDataset.push(JSON.parse(JSON.stringify(row)));
}
})
datagrid.setData(newDataset);
}
};