本文整理汇总了PHP中jqGridRender类的典型用法代码示例。如果您正苦于以下问题:PHP jqGridRender类的具体用法?PHP jqGridRender怎么用?PHP jqGridRender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了jqGridRender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
include_once "../ip-config.php";
require_once '../jq-config.php';
require_once ABSPATH . "php/jqGrid.php";
require_once ABSPATH . "php/jqAutocomplete.php";
require_once ABSPATH . "php/jqGridPdo.php";
$conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
$conn->query("SET NAMES utf8");
$grid = new jqGridRender($conn);
$grid->SelectCommand = 'SELECT id, startdate, name, email, phone, wrkemail, wrkphone, status, communication, notes FROM proxy';
$grid->table = 'proxy';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->datearray = array('startdate');
$grid->setUserDate("Y-m-d");
$grid->setColModel();
$grid->setUrl('proxy.php');
$grid->setColProperty("id", array("editable" => false, "width" => 25, "fixed" => true, "label" => "ID"));
$grid->setColProperty('startdate', array("editable" => false, "width" => 70, "fixed" => true, "formatter" => "date", "label" => "Start Date", "formatoptions" => array("srcformat" => "Y-m-d HH:MM:SS", "newformat" => "m/d/Y"), "searchoptions" => array("dataInit" => "js:function(elm){setTimeout(function(){\n\t\t\t\t\t jQuery(elm).datepicker({dateFormat:'yy-mm-dd'});\n\t\t\t\t\t jQuery('.ui-datepicker').css({'font-size':'75%'});\n\t\t\t },200);}")));
$grid->setColProperty("name", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Name"));
$grid->setAutocomplete("name", null, "select name, name from (SELECT distinct name FROM leads union select distinct name from candidate union select distinct name from recruit) p where name like ? ORDER BY name", null, true, true);
$grid->setColProperty("email", array("editable" => true, "width" => 150, "fixed" => true, "formatter" => "email", "editrules" => array("email" => true, "required" => true), "label" => "Email"));
$grid->setAutocomplete("email", null, "select email, email from (SELECT distinct email FROM leads union select distinct email from candidate union select distinct email from recruit) p where email like ? ORDER BY email", null, true, true);
$grid->setColProperty("phone", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Phone"));
$grid->setAutocomplete("phone", null, "select phone, phone from (SELECT distinct phone FROM leads union select distinct phone from candidate union select distinct phone from recruit) p where phone like ? ORDER BY phone", null, true, true);
$grid->setColProperty("wrkemail", array("editable" => true, "width" => 150, "fixed" => true, "formatter" => "email", "editrules" => array("email" => true, "required" => false), "label" => "Wrk Email"));
$grid->setAutocomplete("wrkemail", null, "select wrkemail, wrkemail from (SELECT distinct wrkemail FROM placement) p where wrkemail like ? ORDER BY wrkemail", null, true, true);
$grid->setColProperty("wrkphone", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Wrk Phone"));
$grid->setAutocomplete("wrkphone", null, "select wrkphone, wrkphone from (SELECT distinct wrkphone FROM placement) p where wrkphone like ? ORDER BY wrkphone", null, true, true);
示例3: define
require_once ABSPATH . "../common_funcs.php";
define('DB_DSN', "mysql:host=" . DBHOST . ";dbname=" . DBNAME);
define('DB_USER', DBADMIN);
define('DB_PASSWORD', DBADMINPW);
// include the jqGrid Class
require_once ABSPATH . "php/jqGrid.php";
// include the driver class
require_once ABSPATH . "php/jqGridPdo.php";
// include pdf
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 name as Mnemonic, seen as Seen, lastseen as LastSeen FROM mne where hidden='false'";
// 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('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
示例4: 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";
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 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", "caption" => "PDF export with custom header"));
// 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"), "search" => false));
$grid->setColProperty("ShipName", array("width" => "250"));
$grid->setColProperty("Freight", array("label" => "Test", "align" => "right"));
// Enable navigator
$grid->navigator = true;
// Enable pdf export on navigator
示例5: jqGridRender
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$grid = new jqGridRender($DB);
$grid->SelectCommand = 'select id, site, status, crawl, crawldate from rec_crawler_site';
$grid->table = 'rec_crawler_site';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->setUserDate("Y-m-d");
$grid->setColModel();
$grid->setUrl('../grids/rec_crawler.php');
$grid->setColProperty("id", array("editable" => false, "frozen" => true, "hidden" => true, "width" => 40, "fixed" => true, "label" => "ID"));
$grid->setColProperty("site", array("editable" => true, "frozen" => true, "width" => 600, "editoptions" => array("size" => 75, "maxlength" => 400), "formatter" => "link", "formatoptions" => array("target" => "_blank"), "fixed" => true, "editrules" => array("url" => true, "required" => false), "label" => "Site"));
$grid->setColProperty("status", array("editable" => true, "width" => 70, "fixed" => true, "label" => "Status", "edittype" => "select"));
$grid->setSelect("status", array("A" => "A", "N" => "N"), false, true, true, array("" => "All"));
$grid->setColProperty("crawl", array("editable" => true, "width" => 120, "fixed" => true, "label" => "Crawl Domain", "edittype" => "select"));
$grid->setSelect("crawl", $yesno, false, true, true, array("" => "All"));
$grid->setColProperty("crawldate", array("formatter" => "date", "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "Crawl 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->setGridOptions(array("sortable" => true, "width" => 1024, "height" => 250, "caption" => "Crawler Site Management", "rownumbers" => true, "rowNum" => 100, "sortname" => "id", "sortorder" => "desc", "toppager" => true, "rowList" => array(10, 20, 30, 50, 100, 500)));
$grid->showError = true;
$grid->navigator = true;
$grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => true, "edit" => true, "del" => false, "view" => true, "search" => true));
$grid->setNavOptions('view', array("width" => 750, "dataheight" => 250, "viewCaption" => "Crawler Site Management"));
$grid->setNavOptions('add', array("width" => 750, "dataheight" => 250, "closeOnEscape" => true, "closeAfterAdd" => true, "addCaption" => "Add Crawler", "bSubmit" => "Add Crawler Site", "reloadAfterSubmit" => false));
$grid->setNavOptions('edit', array("width" => 750, "dataheight" => 250, "closeOnEscape" => true, "closeAfterEdit" => true, "editCaption" => "Update Crawler", "bSubmit" => "Update Crawler Site", "reloadAfterSubmit" => false));
//$grid->toolbarfilter = true;
$grid->callGridMethod('#grid', 'setFrozenColumns');
$grid->callGridMethod('#grid', 'gridResize');
$bindkeys = <<<KEYS
\$("#grid").jqGrid('bindKeys', {"onEnter":function( rowid ) { alert("You enter a row with id:"+rowid)} } );
示例6: PDO
<?php
include_once "../ip-config.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
$conn->query("SET NAMES utf8");
$grid = new jqGridRender($conn);
$grid->SelectCommand = 'SELECT id, employeeid, recruiterid, saledate, status, DATE_FORMAT(lastmoddatetime, "%D %M %Y %h:%i %p %a") as last, notes FROM vendorsales';
$grid->table = 'vendorsales';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->datearray = array('saledate');
$grid->setUserDate("Y-m-d");
$grid->setColModel();
$grid->setUrl('sale.php');
$grid->setColProperty("id", array("editable" => false, "width" => 25, "hidden" => true, "fixed" => true, "label" => "ID"));
$grid->setColProperty("recruiterid", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Recruiter", "edittype" => "select"));
$grid->setSelect("recruiterid", "select '' as id, '' as name from dual union SELECT id, email as name FROM recruiter order by name");
$grid->setColProperty("employeeid", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Employee", "edittype" => "select"));
$grid->setSelect("employeeid", "select '' as id, '' as name from dual union SELECT distinct id, name FROM employee where status = '0Active' order by name");
$grid->setColProperty("saledate", array("formatter" => "date", "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "Sale 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("status", array("editable" => true, "width" => 50, "fixed" => true, "label" => "Status", "edittype" => "select"));
$grid->setSelect("status", array("I" => "Initiated", "S" => "Success", "F" => "FollowUp", "R" => "Rejected"), false, true, true, array("" => "All"));
$grid->setColProperty("last", array("editable" => false, "width" => 200, "fixed" => true, "label" => "Last Updated"));
示例7: jqGridRender
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$grid = new jqGridRender($DB);
$grid->SelectCommand = 'select distinct CONCAT("www.", SUBSTRING(email FROM instr(email, "@")+1)) url, email, positiondate from (select vendor1email as email, positiondate from position where vendor1email is not null union select vendor2email, positiondate from position where vendor2email is not null union select vendor3email, positiondate from position where vendor3email is not null union select client1email, null from interview where client1email is not null union select client2email, null from interview where client2email is not null union select client3email, null from interview where client3email is not null union select vendor1email, interviewdate from interview where vendor1email is not null union select vendor2email, interviewdate from interview where vendor2email is not null union select vendor3email, interviewdate from interview where vendor3email is not null) e ';
$grid->dataType = 'json';
$grid->setColModel();
$grid->setUrl('../grids/newvendoremail.php');
$grid->setColProperty("url", array("editable" => false, "width" => 300, "fixed" => true, "formatter" => "link", "editrules" => array("url" => true, "required" => false), "label" => "URL"));
$grid->setColProperty("email", array("editable" => true, "width" => 500, "fixed" => true, "formatter" => "email", "editrules" => array("email" => true, "required" => true), "label" => "Email"));
$grid->setColProperty("positiondate", array("editable" => false, "hidden" => true, "label" => "ID"));
// Set alternate background using altRows property
$grid->setGridOptions(array("sortable" => true, "width" => 1024, "height" => 250, "caption" => "New Vendor Emails Management", "rownumbers" => true, "rowNum" => 100, "shrinkToFit" => false, "sortname" => "positiondate", "sortorder" => "desc", "toppager" => true, "rowList" => array(10, 100, 500, 1000)));
$grid->showError = true;
$grid->navigator = true;
$grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => false, "edit" => false, "del" => false, "view" => true, "search" => true));
$grid->setNavOptions('view', array("width" => 750, "dataheight" => 500, "viewCaption" => "New Vendor Email Management"));
$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->renderGrid('#grid', '#pager', true, null, null, true, true);
$DB = null;
示例8: jqGridRender
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$grid = new jqGridRender($DB);
$grid->SelectCommand = 'SELECT id,companyname,email,phone,status,url,fax,address,city,state,country,twitter,linkedin,facebook,zip,manager1name,manager1email,manager1phone,hmname,hmemail,hmphone,hrname,hremail,hrphone,notes FROM client';
$grid->table = 'client';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->datearray = array('startdate');
$grid->setUserDate("Y-m-d");
$grid->setColModel();
$grid->setUrl('../grids/client.php');
$grid->setColProperty("id", array("editable" => false, "width" => 40, "fixed" => true, "label" => "ID"));
$grid->setColProperty("companyname", array("editable" => true, "frozen" => true, "width" => 250, "editoptions" => array("size" => 75, "maxlength" => 250, "style" => "text-transform: uppercase"), "fixed" => true, "label" => "Company Name"));
$grid->setColProperty("email", array("editable" => true, "width" => 200, "editoptions" => array("size" => 75, "maxlength" => 250, "style" => "text-transform: lowercase"), "fixed" => true, "formatter" => "email", "editrules" => array("email" => true, "required" => true), "label" => "Email"));
$grid->setColProperty("phone", array("editable" => true, "width" => 150, "editoptions" => array("size" => 75, "maxlength" => 250), "fixed" => true, "label" => "Phone"));
$grid->setColProperty("status", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Status", "edittype" => "select"));
$grid->setSelect("status", $vendorstatus, false, true, true, array("" => "All"));
$grid->setColProperty("url", array("editable" => true, "frozen" => true, "width" => 200, "editoptions" => array("size" => 75, "maxlength" => 200, "style" => "text-transform: lowercase"), "formatter" => "link", "formatoptions" => array("target" => "_blank"), "fixed" => true, "editrules" => array("url" => true, "required" => false), "label" => "Url"));
$grid->setColProperty("fax", array("editable" => true, "width" => 150, "editoptions" => array("size" => 75, "maxlength" => 250), "fixed" => true, "label" => "Fax"));
$grid->setColProperty("address", array("editable" => true, "width" => 150, "editoptions" => array("size" => 75, "maxlength" => 250), "fixed" => true, "label" => "Address"));
$grid->setColProperty("city", array("editable" => true, "width" => 120, "editoptions" => array("size" => 75, "maxlength" => 250), "fixed" => true, "label" => "City"));
$grid->setAutocomplete("city", null, "select name, name from (select distinct city as name from city) p where name like ? ORDER BY name", null, true, true);
$grid->setColProperty("state", array("editable" => true, "width" => 120, "editoptions" => array("size" => 75, "maxlength" => 250), "fixed" => true, "label" => "State"));
$grid->setAutocomplete("state", null, "select name, name from (SELECT distinct name FROM state)p where name like ? ORDER BY name", null, true, true);
$grid->setColProperty("country", array("editable" => true, "width" => 120, "editoptions" => array("size" => 75, "maxlength" => 250), "fixed" => true, "label" => "Country"));
$grid->setAutocomplete("country", null, "select name, name from (SELECT distinct short_name as name FROM country) p where name like ? ORDER BY name", null, true, true);
$grid->setColProperty("zip", array("editable" => true, "width" => 120, "editoptions" => array("size" => 75, "maxlength" => 250), "fixed" => true, "label" => "Zip"));
$grid->setAutocomplete("zip", null, "select name, name from (select zip as name from city) p where name like ? ORDER BY name", null, true, true);
$grid->setColProperty("twitter", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Twitter"));
示例9: jqGridRender
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$grid = new jqGridRender($DB);
$grid->SelectCommand = 'SELECT id, name, email, phone, trainingmessage, companymessage, improvemessage, refer, usefeedback FROM feedback';
$grid->table = 'feedback';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->setColModel();
$grid->setUrl('../grids/feedback.php');
$grid->setColProperty("id", array("editable" => false, "width" => 25, "fixed" => true, "label" => "ID"));
$grid->setColProperty("name", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Name"));
$grid->setColProperty("email", array("editable" => true, "width" => 150, "fixed" => true, "formatter" => "email", "editrules" => array("email" => true, "required" => true), "label" => "Email"));
$grid->setColProperty("phone", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Phone"));
$grid->setColProperty("trainingmessage", array("editable" => true, "hidden" => true, "edittype" => "textarea", "editrules" => array("edithidden" => true, "required" => false), "editoptions" => array("rows" => 6, "cols" => 80), "label" => "Training Message"));
$grid->setColProperty("companymessage", array("editable" => true, "hidden" => true, "edittype" => "textarea", "editrules" => array("edithidden" => true, "required" => false), "editoptions" => array("rows" => 6, "cols" => 80), "label" => "Company Message"));
$grid->setColProperty("improvemessage", array("editable" => true, "hidden" => true, "edittype" => "textarea", "editrules" => array("edithidden" => true, "required" => false), "editoptions" => array("rows" => 6, "cols" => 80), "label" => "Improve Message"));
$grid->setColProperty("refer", array("editable" => true, "label" => "Refer", "width" => 50, "fixed" => true, "edittype" => "select"));
$grid->setSelect("refer", $yesno, false, true, true, array("" => "All"));
$grid->setColProperty("usefeedback", array("editable" => true, "label" => "Use Feedback", "width" => 50, "fixed" => true, "edittype" => "select"));
$grid->setSelect("usefeedback", $yesno, false, true, true, array("" => "All"));
$grid->setGridOptions(array("sortable" => true, "width" => 1024, "height" => 250, "caption" => "Feedback Management", "rownumbers" => true, "rowNum" => 100, "footerrow" => true, "userDataOnFooter" => true, "shrinkToFit" => false, "sortname" => "id", "sortorder" => "desc", "toppager" => true, "rowList" => array(10, 50, 100, 500, 1000)));
$grid->showError = true;
$grid->navigator = true;
$grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => true, "edit" => true, "del" => false, "view" => true, "search" => true));
$grid->setNavOptions('view', array("width" => 750, "dataheight" => 500, "viewCaption" => "Feedback Management"));
$grid->setNavOptions('add', array("width" => 750, "dataheight" => 500, "closeOnEscape" => true, "closeAfterAdd" => true, "addCaption" => "Add Feedback", "reloadAfterSubmit" => false));
$grid->setNavOptions('edit', array("width" => 750, "dataheight" => 500, "closeOnEscape" => true, "closeAfterEdit" => true, "editCaption" => "Update Feedback", "reloadAfterSubmit" => false));
$grid->callGridMethod('#grid', 'setFrozenColumns');
$grid->callGridMethod('#grid', 'gridResize');
示例10: 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
$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 from SQL query
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('grid.php');
// Set alternate background using altRows property
$grid->setGridOptions(array("rowNum" => 10, "sortname" => "OrderID", "rowList" => array(10, 20, 50), "height" => 'auto', "grouping" => true, "groupingView" => array("groupField" => array('CustomerID'), "groupColumnShow" => array(true), "groupText" => array('<b>{0}</b>'), "groupDataSorted" => true)));
// 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")));
// Enjoy
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;
示例11: jqGridRender
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$grid = new jqGridRender($DB);
$grid->SelectCommand = 'SELECT id, name, version, softkey, type, status, link, notes FROM software';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->setColModel();
$grid->setUrl('../grids/software.php');
$grid->setColProperty("id", array("editable" => false, "width" => 25, "hidden" => true, "fixed" => true, "label" => "ID"));
$grid->setColProperty("name", array("editable" => true, "editoptions" => array("size" => 75, "maxlength" => 200), "frozen" => true, "width" => 300, "fixed" => true, "label" => "Name"));
$grid->setColProperty("version", array("editable" => true, "editoptions" => array("size" => 75, "maxlength" => 50), "frozen" => true, "width" => 50, "fixed" => true, "label" => "Version"));
$grid->setColProperty("softkey", array("editable" => true, "editoptions" => array("size" => 75, "maxlength" => 200), "frozen" => true, "width" => 200, "fixed" => true, "label" => "Key"));
$grid->setColProperty("type", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Type", "edittype" => "select"));
$grid->setSelect("type", $softwaretype, false, true, true, array("" => "All"));
$grid->setColProperty("status", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Status", "edittype" => "select"));
$grid->setSelect("status", array("Active" => "Active", "Inactive" => "Inactive"), false, true, true, array("" => "All"));
$grid->setColProperty("link", array("editable" => true, "frozen" => true, "width" => 400, "editoptions" => array("size" => 75, "maxlength" => 200), "formatter" => "link", "fixed" => true, "editrules" => array("url" => true, "required" => false), "label" => "Link"));
$grid->setColProperty("notes", array("editable" => true, "width" => 70, "fixed" => true, "edittype" => "textarea", "editoptions" => array("rows" => 6, "cols" => 80), "label" => "Notes"));
$grid->setGridOptions(array("sortable" => true, "width" => 1024, "height" => 250, "caption" => "Software Management", "rownumbers" => true, "rowNum" => 100, "sortname" => "name", "toppager" => true, "rowList" => array(10, 100, 500)));
$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" => 400, "viewCaption" => "Software Management"));
$grid->setNavOptions('add', array("width" => 750, "dataheight" => 400, "closeOnEscape" => true, "closeAfterAdd" => true, "addCaption" => "Add Software", "bSubmit" => "Add Software", "reloadAfterSubmit" => false));
$grid->setNavOptions('edit', array("width" => 750, "dataheight" => 400, "closeOnEscape" => true, "closeAfterEdit" => true, "editCaption" => "Update Software", "bSubmit" => "Update Software", "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)} } );
示例12: jqGridRender
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$candidateID = $loggedInUser->candidateid;
$grid = new jqGridRender($DB);
// Write the SQL Query
$q = 'select s.clientname, s.type, s.interviewdate, s.status, u.name manager from interview s, employee u where s.mmid = u.id and s.candidateid = ' . $candidateID;
$grid->SelectCommand = $q;
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->setColModel();
$grid->setUrl('../grids/candidateinterviews.php');
$grid->setColProperty("clientname", array("editable" => false, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Client"));
$grid->setColProperty("type", array("editable" => false, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Type"));
$grid->setColProperty("interviewdate", array("editable" => false, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Interview Date"));
$grid->setColProperty("status", array("editable" => false, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Status"));
$grid->setColProperty("manager", array("editable" => false, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Manager"));
// Set alternate background using altRows property
$grid->setGridOptions(array("sortable" => true, "width" => 1024, "height" => 250, "caption" => "Interviews", "rownumbers" => true, "rowNum" => 50, "shrinkToFit" => false, "sortname" => "interviewdate", "sortorder" => "desc", "toppager" => true, "rowList" => array(10, 20, 30, 50, 100, 500)));
$grid->showError = true;
$grid->navigator = true;
$grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => false, "edit" => false, "del" => false, "view" => true, "search" => true));
$grid->setNavOptions('view', array("width" => 750, "dataheight" => 500, "viewCaption" => "Interviews"));
$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->renderGrid('#grid', '#pager', true, null, null, true, true);
$DB = null;
示例13: PDO
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";
// include the autocomplete class
require_once ABSPATH . "php/jqAutocomplete.php";
// 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")));
示例14: jqGridRender
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$employeeid = $_GET['employeeid'];
$grid = new jqGridRender($DB);
$grid->SelectCommand = 'SELECT id, candidateid, candidateid as cid, mmid, type, status, interviewdate, interviewhour, interviewminute, interviewdivision, clientname, clientlocation, vendor1, vendor1email, vendor2, vendor2email, client1email, client2email, client3email, vendor3email, reference, interviewers, interviewersphone, result, performance, portal, reclink, questions, questionslink, notes FROM interview where mmid = "' . $employeeid . '" or mmid in (select id from employee where mgrid = "' . $employeeid . '")';
$grid->table = 'interview';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->datearray = array('interviewdate');
$grid->setUserDate("Y-m-d");
$grid->setColModel();
$grid->setUrl('../grids/rinterview.php?employeeid=' . $employeeid);
$grid->setColProperty("id", array("editable" => false, "hidden" => true, "label" => "ID"));
$grid->setColProperty("cid", array("editable" => false, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Candidate Name", "edittype" => "select"));
$grid->setSelect("cid", "SELECT distinct candidateid as id, name as name FROM candidate order by name");
$grid->setColProperty("candidateid", array("editable" => true, "hidden" => true, "editrules" => array("edithidden" => true, "required" => false), "frozen" => true, "width" => 200, "fixed" => true, "label" => "Candidate Name", "edittype" => "select"));
$grid->setSelect("candidateid", "SELECT distinct candidateid as id, name as name FROM candidate where status in ('Marketing', 'Placed', 'OnProject-Mkt') order by name");
$grid->setColProperty("mmid", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "Manager", "edittype" => "select"));
$grid->setSelect("mmid", "SELECT distinct id, name FROM employee where id = {$employeeid} or mgrid = {$employeeid} order by name");
$grid->setColProperty("interviewdate", array("formatter" => "date", "width" => 80, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d", "elmprefix" => " ", "rowpos" => 5, "colpos" => 1), "editable" => true, "label" => "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("interviewhour", array("editable" => true, "width" => 50, "fixed" => true, "label" => "Time", "formoptions" => array("elmprefix" => " ", "rowpos" => 5, "colpos" => 1), "edittype" => "select"));
$grid->setSelect("interviewhour", $interviewhour, false, true, true, array("" => "All"));
$grid->setColProperty("interviewminute", array("editable" => true, "width" => 50, "fixed" => true, "label" => "Time", "formoptions" => array("elmprefix" => " ", "rowpos" => 5, "colpos" => 1), "edittype" => "select"));
$grid->setSelect("interviewminute", $interviewtime, false, true, true, array("" => "All"));
$grid->setColProperty("interviewdivision", array("editable" => true, "width" => 50, "fixed" => true, "label" => "Time", "formoptions" => array("elmprefix" => " ", "rowpos" => 5, "colpos" => 1), "edittype" => "select"));
$grid->setSelect("interviewdivision", $interviewdivision, false, true, true, array("" => "All"));
$grid->setColProperty("interviewtime", array("editable" => true, "width" => 70, "fixed" => true, "label" => "Time"));
$grid->setColProperty("type", array("editable" => true, "width" => 70, "fixed" => true, "label" => "Type", "edittype" => "select"));
$grid->setSelect("type", $interviewtype, false, true, true, array("" => "All"));
示例15: 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);
// MySQL specific command for the charset
$conn->query("SET NAMES utf8");
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Data from this SQL is 1252 encoded, so we need to tell the grid
// Set the data source to be read from file
$grid->readFromXML = true;
// The first item is the xml file, the second is the query id
$grid->SelectCommand = 'sqlxml.getProducts';
// set the ouput format to XML
$grid->dataType = 'xml';
// Let the grid create the model
$grid->setColModel();
// set labels in the header
$grid->setColProperty("ProductID", array("label" => "ID"));
$grid->setColProperty("ProductName", array("label" => "Name"));
$grid->setColProperty("QuantityPerUnit", array("label" => "Unit"));
$grid->setColProperty("UnitPrice", array("label" => "Unit Price"));
// We can hide some columns
$grid->setColProperty("SupplierID", array("hidden" => true));
$grid->setColProperty("CategoryID", array("hidden" => true));
$grid->setColProperty("UnitsOnOrder", array("hidden" => true));