本文整理汇总了PHP中jqGridRender::setDatepicker方法的典型用法代码示例。如果您正苦于以下问题:PHP jqGridRender::setDatepicker方法的具体用法?PHP jqGridRender::setDatepicker怎么用?PHP jqGridRender::setDatepicker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jqGridRender
的用法示例。
在下文中一共展示了jqGridRender::setDatepicker方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PDO
// include the datepicker class
require_once ABSPATH . "php/jqCalendar.php";
// Connection to the server
$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';
$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');
// 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)));
// Change some property of the field(s)
$grid->setColProperty("OrderID", array("label" => "ID", "width" => 60));
$grid->setColProperty("OrderDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "m/d/Y")));
$grid->setAutocomplete("ShipName", false, "SELECT DISTINCT ShipName FROM orders WHERE ShipName LIKE ? ORDER BY ShipName", null, true, true);
$grid->setDatepicker('OrderDate', null, true, true);
$grid->datearray = array('OrderDate');
// Enjoy
$grid->navigator = true;
$grid->setNavOptions('navigator', array("excel" => false));
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例2: jqGridRender
// 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, ShipName, Freight FROM orders';
// 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" => "OrderID"));
// 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")));
$grid->setColProperty("ShipName", array("width" => "200"));
// Enable navigator
$grid->navigator = true;
// Enable search
// By default we have multiple search enabled
$grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false));
// In order to enable the more complex search we should set multipleGroup option
// Also we need show query roo
$grid->setNavOptions('search', array("multipleGroup" => true, "showQuery" => true));
// client side validation when search
$grid->setColProperty('OrderID', array("searchrules" => array("required" => true, "number" => true, "minValue" => 10200)));
$grid->setDatepicker('OrderDate');
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例3: jqGridRender
// 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 EmployeeID, FirstName, LastName, BirthDate FROM employees';
// Set the table to where you add the data
$grid->table = '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');
$grid->setColProperty('EmployeeID', array("editable" => false));
$grid->setColProperty('BirthDate', array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "Y-m-d")));
// Set some grid options
$grid->setUserTime("m/d/Y");
$grid->setDatepicker("BirthDate", array("buttonOnly" => false));
$grid->setGridOptions(array("rowNum" => 10, "rowList" => array(10, 20, 30), "sortname" => "EmployeeID"));
// navigator first should be enabled
$grid->navigator = true;
$grid->setNavOptions('navigator', array("add" => false, "edit" => false, "excel" => false, "search" => false, "del" => false, "refresh" => false));
// and just enable the inline
$grid->inlineNav = true;
// disable editing - just adding
$grid->inlineNavOptions('navigator', array("edit" => false));
$grid->callGridMethod("#grid", 'setFrozenColumns');
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例4: array
// set the ouput format to json
$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);