I change the value of the quantity. The underlying table is correctly changed and I can get the alert(‘edit done’) fires. However what I want instead of that alert is for the grid to be reloaded to show the newly calculated values that are in the table. If I press the reload button at the bottom of the grid the correct new figures are shown but i would like this to happen if I click on a new line or cell in the grid. What code should I replace alert(‘edit done’) with to achieve this please, or is there a better way to do it?
// Set some grid options
$grid->setGridOptions(array(
“rowNum”=>5,
“sortname”=>”item”,
“rowList”=>array(5,30,50),
“height”=>120,
“width”=>950,
“cellEdit”=> true,
“mtype” => “POST”,
“cellsubmit” => “remote”,
“cellurl” => “includes/ajaxpicked.php”
));
// Enable footerdata an tell the grid to obtain it from the request
$grid->setGridOptions(array(“footerrow”=>true,”userDataOnFooter”=>true));
// reload grid after successful edit
$grid->setGridEvent(“afterSaveCell”, “function(rowid,name,val,iRow,iCol) {alert(‘edit done’)}”);
$grid->addCol(array(“name”=>”act”),”last”);
// Change some property of the field(s)
$grid->setColProperty(“uid”, array(“label”=>”ID”, “width”=>25, “editable”=>false, “hidden”=>true));
$grid->setColProperty(“itemcode”, array(“label”=>”Item Code”, “width”=>60, “editable”=>false));
$grid->setColProperty(“item”, array(“label”=>”Item”, “width”=>150, “editable”=>false));
$grid->setColProperty(“price”, array(“label”=>”Price”, “width”=>80, “editable”=>false));
$grid->setColProperty(“unit”, array(“label”=>”Unit”, “width”=>50, “editable”=>false));
$grid->setColProperty(“quantity”, array(“label”=>”Qty”, “width”=>50, “editable”=>true, “editrules”=>array(“number”=>true)));
$grid->setColProperty(“value”, array(“label”=>”Value”, “width”=>70, “editable”=>false, “editable”=>false, “align”=>”right”, “formatter”=>”number”,”formatoptions”=>array(“thousandsSeparator”=>”,”,”decimalPlaces”=>2)));
$grid->setColProperty(“discount”, array(“label”=>”Disc.”, “width”=>60, “editable”=>false, “align”=>”right”, “formatter”=>”number”,”formatoptions”=>array(“thousandsSeparator”=>”,”,”decimalPlaces”=>2)));
$grid->setColProperty(“tax”, array(“label”=>”Tax”, “width”=>50, “editable”=>false, “align”=>”right”, “formatter”=>”number”,”formatoptions”=>array(“thousandsSeparator”=>”,”,”decimalPlaces”=>2)));
$grid->setColProperty(“tot”, array(“label”=>”Total”, “width”=>50, “editable”=>false, “align”=>”right”, “formatter”=>”number”,”formatoptions”=>array(“thousandsSeparator”=>”,”,”decimalPlaces”=>2)));
$grid->setColProperty(“pay”, array(“label”=>”Pay”, “width”=>20, “editable”=>false, “hidden”=>true));
$grid->setColProperty(“trackserial”, array(“label”=>”Serial”, “width”=>20, “editable”=>false, “hidden”=>true));
$grid->setColProperty(“ref”, array(“label”=>”Ref”, “width”=>20, “editable”=>false, “hidden”=>true));
$grid->setColProperty(“act”, array(“label”=>”Selection”, “width”=>50, “editable”=>false));
// At end call footerData to put total label
$grid->callGridMethod(‘#tradlist’, ‘footerData’, array(“set”,array(“quantity”=>”Total:”)));
// Set which parameter to be sumarized
$summaryrows = array(“value”=>array(“value”=>”SUM”),”tax”=>array(“tax”=>”SUM”),”tot”=>array(“tot”=>”SUM”));
$loadevent = <<
var ids = jQuery(“#purchlist”).getDataIDs();
for(var i=0;i
var cl = ids;
var topay = rowd.pay;
var track = rowd.trackserial;
var rf = “‘”+rowd.ref+”‘”;
var se = “”;
if (topay == ‘N’) {
be = ‘‘;
} else {
be = ‘‘;
if (track == ‘Yes’) {
se = ‘‘;
}
}
jQuery(“#purchlist”).setRowData(ids,{act:be+’ ‘+se});
}
}
LOADCOMPLETE;
Â
$grid->setGridEvent(“loadComplete”,$loadevent);
// Enable navigator
$grid->navigator = true;
// Disable some actions
$grid->setNavOptions(‘navigator’, array(“excel”=>true,”add”=>false,”edit”=>false,”del”=>false,”view”=>false));
// Run the script
$grid->renderGrid(‘#purchlist’,’#purchpager’,true, $summaryrows, null,true,true,true);
?>
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top