console.log(status); console.log(rowid); var ids = jQuery("#orders").jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = jQuery('#orders').jqGrid ('getRowData', rowId); console.log(rowData); console.log(rowId); if(\$("#orders").jqGrid("getCell", rowId, "status") == "Shipped"){ \$("#orders").jqGrid("setCell", rowId, "actions", " zzz ", {"display":"none"}); // not possible to set value for virtual column } } } ONGRIDLOADCOMPLETE; $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->set_col_hidden('comments'); $dg->add_column("actions", array('name' => 'actions', 'index' => 'actions', 'width' => '80', 'formatter' => 'actions', 'formatoptions' => array('keys' => true)), 'Actions'); $dg->set_grid_property(array('onSelectRow' => '')); $dg->add_event("jqGridLoadComplete", $onGridLoadComplete); $dg->enable_edit('INLINE', 'CRUD'); $dg->display(); ?> </body> </html>
$rowattr = <<<ROWATTR function (rowData, inputRowData) { \treturn rowData.status === "OnHold" ? {style: "background-color:blue"} : {}; } ROWATTR; // post data another page after submit $afterSubmit = <<<AFTERSUBMIT function (event, status, postData) { \tconsole.log(postData); alert('going to post customerNumber ' + postData.customerNumber + ' to another page through AJAX call'); \$.ajax({ url: '/my/site', data: {custNum: postData.customerNumber}, // replace customerNumber with your own field name type: 'post', success: function(output) { alert(output); } }); } AFTERSUBMIT; $dg->add_event("jqGridSelectRow", $onSelectRow); $dg->add_event("jqGridSelectRow", $onSelectRow2); $dg->add_event("jqGridrowattr", $rowattr); $dg->add_event("jqGridAddEditAfterSubmit", $afterSubmit); $dg->enable_edit('FORM'); $dg->display(); ?> </body> </html>