I want to use the below function with the user-defined button.
jQuery(document).ready(function(){
jQuery(‘#list1’).jqGrid(‘navButtonAdd’, ‘#list1_pager’,
{
‘id’ : ‘Update Calendar’,
‘caption’ : ‘Update Calendar’,
‘buttonicon’ : ‘ui-icon-save’,
‘onClickButton’ : function()
{
// how to code to use the below function
},
‘position’: ‘last’
});
// Is this function right ??? I think it doesn’t work at all. where should I change?
function update_master($data)
{
// you can also use grid object to execute sql, useful in non-mysql driver
global $grid;
$str = “update DPLSchedule as m
set UpCN51 = (select count(HHT) from DPLmigration as d where d.pid=m.id and d.MgStatus = ‘SUCCESS’ AND d.HHT = ‘CN51’),
UpCT40 = (select count(HHT) from DPLmigration as d where d.pid=m.id and d.MgStatus = ‘SUCCESS’ AND d.HHT = ‘CT40’)
where m.id = {$data[“pid”]}”;
$grid->execute_query($str);
}
You can bulk-edit code. It uses similar toolbar button and php callback function code.
https://www.phpgrid.org/demo/demos/editing/bulk-edit.phps
line 230-241, line 161-166
If you face any issue in integration, email me code and i’ll suggest changes.