To create a support ticket, start a search

Modify the value entered in a grid - Grid JS onEditCell

Prerequisites:

- Store Commander version 2014-03-12
- SC Grids Editor Pro Add-on - version 1.0
- Follow instructions Products Grid: Adding a field from ps_product_lang table to create a field 'shipping info'.


Target:

We would like to modify the value in field 'shipping info' to truncate the data if it goes over 100 characters, and then send this value to the server to get registered in the database.

 

Setup: 

In the panel Advanced Properties:

Grid JS onEditCell:

 

// onEditCell(stage,rId,cInd,nValue,oValue)
// rId is the row ID
// cInd is the column INDEX
// nValue is the new value
// oValue is the old value

if (nValue!=oValue){

idxDeliveryInfo=cat_grid.getColIndexById('infos_livraison');
if (cInd == idxDeliveryInfo){
cat_grid.cells(rId,idxDeliveryInfo).setValue(cat_grid.cells(rId,idxDeliveryInfo).getValue().substr(0,100));
}
}

 

You will need to reset Store Commander to apply the new modifications.