本文整理汇总了PHP中jqGridRender::setAfterCrudAction方法的典型用法代码示例。如果您正苦于以下问题:PHP jqGridRender::setAfterCrudAction方法的具体用法?PHP jqGridRender::setAfterCrudAction怎么用?PHP jqGridRender::setAfterCrudAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jqGridRender
的用法示例。
在下文中一共展示了jqGridRender::setAfterCrudAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jqGridRender
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT CustomerID, CompanyName, Phone, PostalCode, City FROM customers';
// Set the table to where you update the data
$grid->table = 'customers';
// Set output format to json
$grid->dataType = 'json';
$grid->setPrimaryKeyId('CustomerID');
// Let the grid create the model
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('grid.php');
// Set some grid options
$grid->setGridOptions(array("rowNum" => 10, "rowList" => array(10, 20, 30), "sortname" => "CustomerID"));
$grid->setColProperty('CustomerID', array("editoptions" => array("readonly" => true)));
// For demonstration purposes only we will update the Customer name adding at end of
// the field U after the data is updated from the user
// We can set ulimited commands after edit occur.
// The same apply for del and add operation
$cid = jqGridUtils::GetParam('CustomerID');
// This command is executed immediatley after edit occur.
$grid->setAfterCrudAction('edit', "UPDATE customers SET CompanyName = CONCAT(CompanyName,' -U') WHERE CustomerID=?", array($cid));
// Enable navigator
$grid->navigator = true;
// Enable only editing
$grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => true, "del" => false, "view" => true, "search" => false));
// Close the dialog after editing
$grid->setNavOptions('edit', array("closeAfterEdit" => true, "editCaption" => "Update Customer", "bSubmit" => "Update"));
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;