本文整理汇总了PHP中jqGridRender::setGridEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP jqGridRender::setGridEvent方法的具体用法?PHP jqGridRender::setGridEvent怎么用?PHP jqGridRender::setGridEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jqGridRender
的用法示例。
在下文中一共展示了jqGridRender::setGridEvent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// Set the url from where we obtain the data
$grid->setUrl('includes/grid/mne.php');
// Set some grid options
$grid->setGridOptions(array("rowNum" => 19, "sortname" => "LastSeen", "sortorder" => "desc", "altRows" => true, "multiselect" => true, "scrollOffset" => 25, "shrinkToFit" => true, "setGridHeight" => "100%", "rowList" => array(20, 40, 60, 75, 100, 500, 750, 1000), "loadComplete" => "js:"));
$grid->setColProperty('Seen', array('width' => '20', 'formatter' => 'js:grid_formatSeen'));
$grid->setColProperty('LastSeen', array('width' => '35', 'formatter' => 'js:easyDate'));
$grid->navigator = true;
$grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => false, "edit" => false, "del" => false, "view" => false, "search" => true));
$gridComplete = <<<ONCOMPLETE
\tfunction ()
\t{\t
\t setRememberedCheckboxesForDialog('mnemonics','gbox_mnegrid',12,'portlet_Mnemonics');
\t}
ONCOMPLETE;
$grid->setGridEvent('loadComplete', $gridComplete);
$custom = <<<CUSTOM
//---------------------------------------------------------------
// BEGIN: Mnemonic Select Dialog
//---------------------------------------------------------------
\$("#portlet-header_Mnemonics .ui-icon-search").click(function() {
\$("#mne_dialog").dialog({
bgiframe: true,
resizable: false,
height: '600',
width: '90%',
position: "center",
autoOpen:false,
modal: false,
title: "Mnemonic Selector",
示例2: PDO
$conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8");
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders';
// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('grid.php');
// Set the initial sorting column using the sortname oprion
$grid->setGridOptions(array("sortname" => "OrderID", "rowNum" => 10, "rowList" => array(10, 20, 30)));
// Change some property of the field(s)
$grid->setColProperty("OrderDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "m/d/Y")));
$sorcol = <<<ONSORTCOL
function (fieldName, columnIndex, sortOrder)
{
// fieldName is the DataField of the column being sorted
// columnIndex is the index of the column (zero bazed)
// sortOrder is a string "asc" or "desc"
var line = "<b>Column sorted</b>: " + fieldName + "; Index: " + columnIndex + "; sortOrder: " + sortOrder + "<br/>";
\$("#log").append(line);
}
ONSORTCOL;
$grid->setGridEvent('onSortCol', $sorcol);
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例3: jQuery
jQuery("#detail").jqGrid('setGridParam',{postData:{EmployeeID:rowid}});
jQuery("#detail").trigger("reloadGrid");
\t\t// Enable CRUD buttons in navigator when a row is selected
\t\tjQuery("#add_detail").removeClass("ui-state-disabled");
\t\tjQuery("#edit_detail").removeClass("ui-state-disabled");
\t\tjQuery("#del_detail").removeClass("ui-state-disabled");
}
}
ORDER;
// We should clear the grid data on second grid on sorting, paging, etc.
$cleargrid = <<<CLEAR
function(rowid, selected)
{
// clear the grid data and footer data
\tjQuery("#detail").jqGrid('clearGridData',true);
\t// Disable CRUD buttons in navigator when a row is not selected
\tjQuery("#add_detail").addClass("ui-state-disabled");
\tjQuery("#edit_detail").addClass("ui-state-disabled");
\tjQuery("#del_detail").addClass("ui-state-disabled");
}
CLEAR;
$grid->setGridEvent('onSelectRow', $selectorder);
$grid->setGridEvent('onSortCol', $cleargrid);
$grid->setGridEvent('onPaging', $cleargrid);
// Enable navigator
$grid->navigator = true;
// Enable only editing
$grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false));
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例4: array
$grid->dataType = 'json';
$grid->table = "orders";
$grid->setPrimaryKeyId("OrderID");
// Let the grid create the model
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('grid.php');
$grid->cacheCount = true;
// Set grid caption using the option caption
$grid->setGridOptions(array("caption" => "This is custom Caption", "rowNum" => 10, "sortname" => "OrderID", "hoverrows" => true, "rowList" => array(10, 20, 50), "postData" => array("grid_recs" => 776)));
// Change some property of the field(s)
$grid->setColProperty("OrderID", array("label" => "ID", "width" => 60, "editable" => false));
$grid->setColProperty("OrderDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "m/d/Y")));
$grid->setAutocomplete("CustomerID", false, "SELECT CustomerID, CompanyName FROM customers WHERE CompanyName LIKE ? ORDER BY CompanyName", null, true, true);
$grid->setDatepicker("OrderDate", array("buttonOnly" => false));
$grid->datearray = array('OrderDate');
// Enjoy
$grid->navigator = false;
$onselrow = <<<ONSELROW
function(rowid, selected)
{
\tif(rowid && rowid !== lastSelection) {
\t\t\$("#grid").jqGrid('restoreRow', lastSelection);
\t\t\$("#grid").jqGrid('editRow', rowid, true);
\t\tlastSelection = rowid;
\t}
}
ONSELROW;
$grid->setGridEvent('onSelectRow', $onselrow);
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例5: jqGridRender
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT CustomerID, CompanyName, ContactName, Phone, City FROM customers';
// Set the table to where you update the data
$grid->table = 'customers';
// Set output format to json
$grid->dataType = 'json';
// 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("label" => "ID", "width" => 50));
$selectorder = <<<ORDER
function(rowid, selected)
{
if(rowid != null) {
jQuery("#detail").jqGrid('setGridParam',{postData:{CustomerID:rowid}});
jQuery("#detail").trigger("reloadGrid");
}
}
ORDER;
$grid->setGridEvent('onSelectRow', $selectorder);
// Enable navigator
$grid->navigator = true;
// Enable only editing
$grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false));
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;