Hi I have the following jqgrid columns, onclick on approve button I need to send an ID to servlet thro ajax.
colNames: ['EmployeeID','Name', 'From Date', 'To Date', 'Reason', ''],
colModel: [
{name:'employeeID', index:'emp_Id', width:55 },
{name: 'employeeName', index:'name', width:90},
{name: 'leave_from', index:'from_date', width: 90},
{name: 'leave_to', index:'to_date', width: 90},
{name: 'reason', index:'status', width: 90},
{name: 'option', index: 'option', width:150, sortable:false},
],
Custom Button Code
loadComplete: function(){
//alert('loading Complete');
var id = jQuery('#jqqGrid').getDataIDs();
for(var i=0; i<id.length; i++){
//var c1 = id[i];
approve = "<input style='height:22px;width:60px;' type='button' onclick= \"approveLeave();\" Value='Approve'/><br />";
reject = "<input style='height:22px;width:60px;' type='button' onclick= \"rejectLeave();\" Value='Reject'/><br />";
jQuery('#jqqGrid').jqGrid('setRowData',id[i], {option:approve+reject});
}
I am able to see the buttons in my grid, my problem is to send an ID through onclick function,
Sample Json object
{"currentPage":1,"totalPages":1,"totalRecords":1,"rows":[{"Id":1016,"cell":{"leave_from":"19/08/2013","leave_to":"23/08/2013","dateofLeaveRequest":"8/18/2013","reason":"Vaccation ","leave_id":1016,"id":0,"employeeID":1029,"employeeName":"Arun Kumar"}}]}
I want to pass the ID through my onclick function. Not sure how to achieve it. Any help is highly appreciated.
Thanks