Custom button in action column
cust_prop_jsonstr
to insert the jqGrid property actionsNavOptions
.Below is the code snippet:
$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
$dg->cust_prop_jsonstr = 'actionsNavOptions: {
addUsericon: "fa-user-plus",
addUsertitle: "Add user",
deleteUsericon: "fa-user-times",
deleteUsertitle: "Delete user",
addToCarticon: "fa-cart-plus",
addToCarttitle: "Add item to the cart",
custom: [
{ action: "addUser", position: "first", onClick: function (options) { alert("Add user, rowid=" + options.rowid); } },
{ action: "addToCart", position: "first", onClick: function (options) { alert("Add to Cart, rowid=" + options.rowid); } },
{ action: "deleteUser", onClick: function (options) { alert("Delete user, rowid=" + options.rowid); } }
]
},';
$dg->add_column("actions", array('name'=>'actions', 'sortable'=>false,
'index'=>'actions',
'width'=>'150',
'formatter'=>'actions',
'formatoptions'=>array('keys'=>true, 'editbutton'=>true, 'delbutton'=>true)),'Actions');
$dg -> display();