sebenernya ini gakjauh beda dari grid2 javascrpt lainya cuma ini saya modifikasi sedikit biar mudah penggunanya buat teman2 saya yang ingin mengunakan grid ini.
download dari sumbernya dulu dan ambil file2 ini
this.getSelRows=function()
{
var rows = jQuery(this.grid).jqGrid("getGridParam","selarrrow");
return this.rowid;
}
}
function imageFormatter(cellValue, options, rowObject)
{
return "<img >";
}
// cellValue - the original value of the cell
// options - as set of options, e.g
// options.rowId - the primary key of the row
// options.colModel - colModel of the column
// cellObject - the HMTL of the cell (td) holding the actual value
function imageUnformatter(cellValue, options, cellObject)
{
return $(cellObject.html()).attr("originalValue");
}
function booleanFormatter(cellValue, options, rowObject)
{
var op;
op = $.extend({},options.colModel.formatoptions);
myCars=new Array();
//alert(op.No);
//mycars[cellValue]= op.boolean.No;
//mycars[cellValue]= op.boolean.Yes;
myCars[op.No]="No";
myCars[op.Yes]="Yes";
//alert(options[boolean]);
return myCars[cellValue];
}
function booleanUnformatter(cellValue, options, cellObject)
{ var op;
op = $.extend({},options.colModel.formatoptions);
//alert(op.No);
if(cellValue=="No")
return (op.No);
else
return (op.Yes);
//alert(op.boolean.Yes)
//return (op.boolean.cellValue);
// myCars=new Array();
// myCars["No"]='0';
// myCars["Yes"]=1;
//alert(myCars[cellValue]);
//alert(options.colModel.formatoptions[1]);
//return myCars[cellValue];
}
// display ajax reponse used for debug for inline edit
function aftersavefunc(rowid, d){}