本文整理汇总了PHP中jqGridRender::setSubGridGrid方法的典型用法代码示例。如果您正苦于以下问题:PHP jqGridRender::setSubGridGrid方法的具体用法?PHP jqGridRender::setSubGridGrid怎么用?PHP jqGridRender::setSubGridGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jqGridRender
的用法示例。
在下文中一共展示了jqGridRender::setSubGridGrid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_main_grid
function get_main_grid()
{
global $myconn, $customers;
$myconn->query("SET NAMES utf8");
//execute the query specifical to your database
$sth = $myconn->prepare('SELECT CustomerID, CompanyName, ContactName, Phone, City FROM customers');
$sth->execute();
// get the data as array. Nothe the the customer array
// is passed in the select command
$customers = $sth->fetchAll(PDO::FETCH_ASSOC);
// end of custom code
//var_dump($customers);
// create the array connection
$conn = new jqGridArray();
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT * 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, "height" => 250, "rowList" => array(10, 20, 30), "sortname" => "CustomerID"));
$grid->setColProperty('CustomerID', array("label" => "ID", "width" => 50));
$grid->setSubGridGrid("subgrid.php");
// 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);
}
示例2: PDO
<?php
require_once '../../../jq-config.php';
// include the jqGrid Class
require_once ABSPATH . "php/jqGrid.php";
// include the driver class
require_once ABSPATH . "php/jqGridPdo.php";
// Connection to the server
$conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
// Tell the db that we use utf-8
jqGridDB::query($conn, "SET NAMES utf8");
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT EmployeeID, LastName, FirstName, Title FROM employees';
// 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, "height" => 250, "rowList" => array(10, 20, 30), "sortname" => "EmployeeID"));
//the icons of the subgrid
$grid->setGridOptions(array("subGridOptions" => array("plusicon" => "ui-icon-triangle-1-e", "minusicon" => "ui-icon-triangle-1-s", "openicon" => "ui-icon-arrowreturn-1-e")));
// Set the url from where we get the data
$grid->setSubGridGrid('details.php');
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例3: array
// Let the grid create the model from SQL query
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('project.php?status=' . $status);
// Change some property of the field(s)
$grid->setColProperty("id", array("editable" => false, "hidden" => true, "label" => "ID"));
$grid->setColProperty("startdate", array("formatter" => "date", "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "Start Date", "editoptions" => array("dataInit" => "js:function(elm){setTimeout(function(){\n \t\t\t\t\t\t\t jQuery(elm).datepicker({dateFormat:'yy-mm-dd'});\n \t\t\t\t\t\t\t jQuery('.ui-datepicker').css({'font-size':'75%'});\n \t\t\t\t\t\t\t\t\t },200);}"), "searchoptions" => array("dataInit" => "js:function(elm){setTimeout(function(){\n \t\t\t\t\t\t\t jQuery(elm).datepicker({dateFormat:'yy-mm-dd'});\n \t\t\t\t\t\t\t jQuery('.ui-datepicker').css({'font-size':'75%'});\n \t\t\t\t\t\t\t\t\t },200);}")));
$grid->setColProperty("name", array("editable" => true, "width" => 400, "edittype" => "text", "editoptions" => array("size" => 100, "maxlength" => 400), "fixed" => true, "label" => "Name"));
//$grid->setColProperty("description", array("editable"=>true, "width"=>300, "edittype"=>"text","editoptions"=>array("size"=>100, "maxlength"=>400), "fixed"=>true, "label"=>"Description"));
$grid->setColProperty("priority", array("editable" => true, "width" => 70, "fixed" => true, "label" => "Priority", "edittype" => "select"));
$grid->setSelect("priority", $taskpriority, false, true, true, array("" => "All"));
$grid->setColProperty("status", array("editable" => true, "width" => 70, "fixed" => true, "label" => "Status", "edittype" => "select"));
$grid->setSelect("status", $taskstatus, false, true, true, array("" => "All"));
$grid->setColProperty("closedate", array("formatter" => "date", "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "Close Date", "editoptions" => array("dataInit" => "js:function(elm){setTimeout(function(){\n \t\t\t\t\t\t\t jQuery(elm).datepicker({dateFormat:'yy-mm-dd'});\n \t\t\t\t\t\t\t jQuery('.ui-datepicker').css({'font-size':'75%'});\n \t\t\t\t\t\t\t\t\t },200);}"), "searchoptions" => array("dataInit" => "js:function(elm){setTimeout(function(){\n \t\t\t\t\t\t\t jQuery(elm).datepicker({dateFormat:'yy-mm-dd'});\n \t\t\t\t\t\t\t jQuery('.ui-datepicker').css({'font-size':'75%'});\n \t\t\t\t\t\t\t\t\t },200);}")));
$grid->setColProperty("notes", array("editable" => true, "width" => 400, "fixed" => true, "edittype" => "textarea", "editoptions" => array("rows" => 6, "cols" => 80), "label" => "Notes"));
$grid->setGridOptions(array("sortable" => true, "width" => 1024, "height" => 600, "caption" => "Project Management", "rownumbers" => true, "rowNum" => 100, "sortname" => "startdate", "sortorder" => "asc", "toppager" => true, "rowList" => array(10, 20, 30, 50, 100)));
$grid->showError = true;
$grid->navigator = true;
$grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => true, "edit" => true, "del" => true, "view" => true, "search" => true));
$grid->setNavOptions('view', array("width" => 750, "dataheight" => 300, "viewCaption" => "Project Management"));
$grid->setNavOptions('add', array("width" => 750, "dataheight" => 300, "closeOnEscape" => true, "closeAfterAdd" => true, "addCaption" => "Add Project", "reloadAfterSubmit" => false));
$grid->setNavOptions('edit', array("width" => 750, "dataheight" => 300, "closeOnEscape" => true, "closeAfterEdit" => true, "editCaption" => "Update Project", "reloadAfterSubmit" => false));
$grid->callGridMethod('#grid', 'setFrozenColumns');
$grid->callGridMethod('#grid', 'gridResize');
$bindkeys = <<<KEYS
\$("#grid").jqGrid('bindKeys', {"onEnter":function( rowid ) { alert("You enter a row with id:"+rowid)} } );
KEYS;
$grid->setJSCode($bindkeys);
$grid->setSubGridGrid('projectdetail.php');
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;