当前位置: 首页>>代码示例>>PHP>>正文


PHP jqGridRender::setColModel方法代码示例

本文整理汇总了PHP中jqGridRender::setColModel方法的典型用法代码示例。如果您正苦于以下问题:PHP jqGridRender::setColModel方法的具体用法?PHP jqGridRender::setColModel怎么用?PHP jqGridRender::setColModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jqGridRender的用法示例。


在下文中一共展示了jqGridRender::setColModel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
开发者ID:nong053,项目名称:prototype-nnit,代码行数:38,代码来源:grid.php

示例2: PDO

// 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
$conn->query("SET NAMES utf8");
// Create the jqGrid instance
$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->setPrimaryKeyId('CustomerID');
$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, "gridview" => false, "rowList" => array(10, 20, 30), "sortname" => "CustomerID"));
$grid->setColProperty('CustomerID', array("label" => "ID", "width" => 50));
// Set the parameters for the subgrid
$grid->setSubGrid("subgrid.php", array('OrderID', 'RequiredDate', 'ShipName', 'ShipCity', 'Freight'), array(60, 120, 150, 100, 70), array('left', 'left', 'left', 'left', 'right'));
// 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;
开发者ID:nong053,项目名称:prototype-nnit,代码行数:31,代码来源:grid.php

示例3: PDO

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
$conn->query("SET NAMES utf8");
// Get the needed parameters passed from the main grid
$rowid = jqGridUtils::GetParam('EmployeeID', 0);
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = "SELECT OrderID, RequiredDate, ShipName, ShipCity, Freight, EmployeeID FROM orders WHERE EmployeeID= ?";
// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model
$grid->setPrimaryKeyId('OrderID');
$grid->setColModel(null, array((int) $rowid));
// Set the url from where we obtain the data
$grid->setUrl('detail.php');
// Set some grid options
$grid->setGridOptions(array("rowNum" => 10, "footerrow" => true, "userDataOnFooter" => true, "sortname" => "OrderID", "height" => 110));
// Change some property of the field(s)
$grid->setColProperty("RequiredDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "m/d/Y"), "search" => false));
// on beforeshow form when add we get the customer id and set it for posting
$beforeshow = <<<BEFORE
function(formid)
{
var srow = jQuery("#grid").jqGrid('getGridParam','selrow');
if(srow) {
\tvar gridrow = jQuery("#grid").jqGrid('getRowData',srow);
\t\$("#CustomerID",formid).val(gridrow.CustomerID);
}
开发者ID:nong053,项目名称:prototype-nnit,代码行数:31,代码来源:detail.php

示例4: PDO

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
$conn->query("SET NAMES utf8");
// Get the needed parameters passed from the main grid
$subtable = jqGridUtils::Strip($_REQUEST["subgrid"]);
$rowid = jqGridUtils::Strip($_REQUEST["rowid"]);
if (!$subtable && !$rowid) {
    die("Missed parameters");
}
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = "SELECT OrderID, ProductID, Quantity, UnitPrice FROM order_details WHERE OrderID=?";
// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model
$grid->setColModel(null, array(&$rowid));
// Set the url from where we obtain the data
$grid->setUrl('subsubgrid.php');
// Set some grid options
$grid->setGridOptions(array("width" => 480, "rowNum" => 10, "sortname" => "OrderID", "height" => 'auto', "postData" => array("subgrid" => $subtable, "rowid" => $rowid)));
// Change some property of the field(s)
$grid->navigator = true;
$grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false));
// Enjoy
$subtable = $subtable . "_t";
$pager = $subtable . "_p";
$grid->renderGrid($subtable, $pager, true, null, array(&$rowid), true, true);
$conn = null;
开发者ID:nong053,项目名称:prototype-nnit,代码行数:31,代码来源:subsubgrid.php

示例5: PDO

require_once(ABSPATH.'/php/tcpdf/config/lang/eng.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
$sel_command = "SELECT host as Host, seen as Seen, lastseen as LastSeen, rbac_key as Rbac_Key  FROM hosts where rbac( ? , rbac_key ) and hidden='false'";
	$grid->SelectCommand = $sel_command;

// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model
$grid->setColModel(null, array($securi));
// Set the url from where we obtain the data
$grid->setUrl("includes/grid/rbac-hosts.php?securi=".$securi);
// 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:"
    ));
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:31,代码来源:rbac-hosts.php

示例6: PDO

<?php

require_once '../../../jq-config.php';
//require_once ABSPATH."php/jqUtils.php";
require_once ABSPATH . "php/jqGrid.php";
//require_once ABSPATH."php/jqGridArray.php";
//require_once ABSPATH."php/jqGridPdo.php";
require_once ABSPATH . "php/jqChart.php";
ini_set("display_errors", "1");
// get your data manually and build the array
$myconn = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
$myconn->query("SET NAMES utf8");
$sth = $myconn->prepare("SELECT CustomerID, SUM(Freight) AS Freight FROM orders WHERE  (CustomerID ='BERGS' OR  CustomerID ='WHITC' ) AND OrderDate BETWEEN '1997-01-01' AND '1997-12-31' GROUP BY CustomerID");
$sth->execute();
$customers = $sth->fetchAll(PDO::FETCH_ASSOC);
$chart = new jqChart();
$chart->setChartOptions(array("defaultSeriesType" => "bar"))->setTitle(array('text' => 'Freight  1997'))->setyAxis(array("title" => array("text" => "Freight")))->setJSCode("mychart = chart;")->setTooltip(array("formatter" => "function(){return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y;}"))->addSeries($customers[0]['CustomerID'], array($customers[0]['Freight']))->addSeries($customers[1]['CustomerID'], array($customers[1]['Freight']));
echo $chart->renderChart('', true, 700, 350);
// building the grid
$grid = new jqGridRender(null);
$grid->setColModel(array(array("name" => "CustomerID", "key" => true), array("name" => "Freight")));
$grid->setUrl('grid.php');
$grid->setGridOptions(array("datatype" => "local", "data" => $customers));
$grid->navigator = false;
$grid->renderGrid('#grid', '#pager', true, null, null, false, false);
// Enjoy
开发者ID:nong053,项目名称:prototype-nnit,代码行数:26,代码来源:chart.php

示例7: PDO

require_once ABSPATH . '/php/tcpdf/config/lang/eng.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 id,description,pattern,mailto,mailfrom,subject,body,disabled FROM triggers';
// set the ouput format to json
$grid->dataType = 'json';
$grid->table = 'triggers';
$grid->setPrimaryKeyId('id');
$labels = array("description" => "Description", "pattern" => "Regex Pattern", "mailto" => "Mail Recipient", "mailfrom" => "Mail Originator", "subject" => "Mail Subject", "body" => "Mail Body", "disabled" => "Disabled?");
// Let the grid create the model
$grid->setColModel(null, null, $labels);
$grid->setColProperty('id', array('hidden' => true));
$grid->setColProperty('disabled', array('width' => '50', "edittype" => "select"));
$grid->setColProperty('body', array("edittype" => "textarea", "editoptions" => array("rows" => 2, "cols" => 40), "width" => 200));
$grid->setColProperty('pattern', array("edittype" => "textarea", "editoptions" => array("rows" => 1, "cols" => 40), "width" => 200));
// Set the url from where we obtain the data
$grid->setUrl('includes/grid/email_alerts.php');
$grid->addCol(array("name" => "Actions", "formatter" => "actions", "editable" => false, "sortable" => false, "resizable" => false, "fixed" => true, "width" => 60, "formatoptions" => array("keys" => true)), "first");
// Set some grid options
$grid->setGridOptions(array("rowNum" => 18, "sortname" => "id", "sortorder" => "asc", "altRows" => true, "rowList" => array(20, 40, 60, 75, 100), "forceFit" => true));
$choices = array("Yes" => "Yes", "No" => "No");
// $grid->setSelect("disabled", $choices , false, false, true, array(""=>"All"));
$grid->setSelect("disabled", $choices, false, true, true, array("" => "All"));
$grid->navigator = true;
$grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => true, "edit" => false, "del" => false, "view" => false, "search" => true));
$grid->setNavOptions('edit', array("width" => "auto", "height" => "auto", "dataheight" => "auto", "top" => 200, "left" => 200));
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:31,代码来源:email_alerts.php

示例8: jqGridRender

<?php

require_once '../../../jq-config.php';
// include the jqGrid Class
require_once ABSPATH . "php/jqGrid.php";
// Create the jqGrid instance
$grid = new jqGridRender();
// Lets create the model manually
$Model = array(array("name" => "Integer", "width" => 80, "formatter" => "integer", "formatoptions" => array("thousandsSeparator" => ","), "sorttype" => "integer"), array("name" => "Number", "width" => 80, "formatter" => "number", "formatoptions" => array("decimalPlaces" => 1), "sorttype" => "number"), array("name" => "Currency", "width" => 80, "formatter" => "currency", "formatoptions" => array("decimalPlaces" => 1, "thousandsSeparator" => ",", "prefix" => "\$", "suffix" => " USD"), "sorttype" => "currency"), array("name" => "Email", "width" => 120, "formatter" => "email"), array("name" => "Link", "width" => 120, "formatter" => "link"), array("name" => "Checkbox", "width" => 50, "formatter" => "checkbox"));
// Let the grid create the model
$grid->setColModel($Model);
// Set grid option datatype to be local
$grid->setGridOptions(array("datatype" => "local"));
//We can add data manually using arrays
$data = array(array("Integer" => 200000, "Number" => 60000000.73, "Currency" => 34.2, "Email" => "john.smith@yahoo.com", "Link" => "http://www.yahoo.com", "Checkbox" => "Yes"), array("Integer" => 1600000, "Number" => 75200000.23, "Currency" => 245.2, "Email" => "joe.woe@google.com", "Link" => "http://www.google.com", "Checkbox" => "Yes"), array("Integer" => 652693, "Number" => 34534000.33, "Currency" => 18545.2, "Email" => "julia.bergman@bing.com", "Link" => "http://www.bing.com", "Checkbox" => "No"), array("Integer" => 1237, "Number" => 3450.3, "Currency" => 55597545.2, "Email" => "roy.corner@msn.com", "Link" => "http://www.msn.com", "Checkbox" => "No"));
// Let put it using the callGridMethod
$grid->callGridMethod("#grid", 'addRowData', array("Integer", $data));
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
开发者ID:nong053,项目名称:prototype-nnit,代码行数:18,代码来源:grid.php


注:本文中的jqGridRender::setColModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。