コード例 #1
0
ファイル: grid.php プロジェクト: nong053/prototype-nnit
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
0
ファイル: grid.php プロジェクト: nong053/prototype-nnit
// 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;
コード例 #3
0
ファイル: email_group.php プロジェクト: sangikumar/IP
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
// Create the jqGrid instance
$grid = new jqGridRender($DB);
// Write the SQL Query
$grid->SelectCommand = 'SELECT id, name, dbsql from ip_email_group';
// Set the table to where we add the data
$grid->table = 'ip_email_group';
$grid->setPrimaryKeyId('id');
$grid->serialKey = false;
// 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('../grids/email_group.php');
// Change some property of the field(s)
$grid->setColProperty("id", array("editable" => false, "hidden" => true, "width" => 25, "fixed" => true, "label" => "ID"));
$grid->setColProperty("name", array("editable" => true, "width" => 100, "fixed" => true, "label" => "Name"));
$grid->setColProperty("dbsql", array("editable" => true, "edittype" => "textarea", "label" => "SQL", "width" => 750, "fixed" => true, "editoptions" => array("rows" => 10, "cols" => 80)));
// Set alternate background using altRows property
$grid->setGridOptions(array("sortable" => true, "width" => 1024, "height" => 250, "caption" => "Email Group Management", "rownumbers" => true, "rowNum" => 30, "sortname" => "name", "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" => false, "view" => true, "search" => true));
$grid->setNavOptions('view', array("width" => 750, "dataheight" => 500, "viewCaption" => "Email Group Management"));
$grid->setNavOptions('add', array("width" => 750, "dataheight" => 500, "closeOnEscape" => true, "closeAfterAdd" => true, "addCaption" => "Add Course", "bSubmit" => "Add Email Group", "reloadAfterSubmit" => false));
$grid->setNavOptions('edit', array("width" => 750, "dataheight" => 500, "closeOnEscape" => true, "closeAfterEdit" => true, "editCaption" => "Update Course", "bSubmit" => "Update Email Group", "reloadAfterSubmit" => false));
//$grid->toolbarfilter = true;
$grid->callGridMethod('#grid', 'setFrozenColumns');
コード例 #4
0
ファイル: grid.php プロジェクト: nong053/prototype-nnit
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 CustomerID, CompanyName, Phone, PostalCode, Country, City FROM customers';
// Set the table to where you update the data
$grid->table = 'customers';
$grid->setPrimaryKeyId("CustomerID");
$grid->serialKey = false;
// 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("editoptions" => array("readonly" => true)));
$grid->setColProperty('City', array("edittype" => "select", "editoptions" => array("value" => " :Select")));
$grid->setSelect("Country", "SELECT DISTINCT Country, Country FROM customers ORDER BY Country", true, true, false);
//$grid->setSelect("City","SELECT DISTINCT City, City FROM customers ORDER BY City", true, true, false);
// This event check if we are in add or edit mode and is lunched
// every time the form opens.
コード例 #5
0
ファイル: detail.php プロジェクト: nong053/prototype-nnit
// 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");
// 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);
コード例 #6
0
ファイル: grid.php プロジェクト: nong053/prototype-nnit
// 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")));
$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));
コード例 #7
0
ファイル: session.php プロジェクト: sangikumar/IP
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
// Create the jqGrid instance
$grid = new jqGridRender($DB);
// Write the SQL Query
$grid->SelectCommand = 'select sessionid, instructorid, candidateid, title, status, sessiondate, type, candidate2id, candidate3id, candidate4id, candidate5id, subject, performance, feedback, recorded, uploaded, link, videoid, notes from session';
// Set the table to where we add the data
$grid->table = 'session';
$grid->setPrimaryKeyId('sessionid');
$grid->serialKey = false;
// set the ouput format to json
$grid->dataType = 'json';
$grid->datearray = array('sessiondate');
$grid->setUserDate("Y-m-d");
// Let the grid create the model from SQL query
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('../grids/session.php');
// Change some property of the field(s)
$grid->setColProperty("sessionid", array("editable" => false, "hidden" => true, "label" => "ID"));
$grid->setColProperty("candidateid", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Candidate Name", "edittype" => "select"));
$grid->setSelect("candidateid", "select '' as id, ' Group Mock' as name from dual union SELECT distinct candidateid as id, name as name FROM candidate where status not in ('Discontinued' , 'Completed' , 'Defaulted') order by name");
$grid->setColProperty("candidate2id", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Candidate2 Name", "edittype" => "select"));
$grid->setSelect("candidate2id", "select null as id, '' as name from dual union SELECT distinct candidateid as id, name as name FROM candidate where status not in ('Discontinued' , 'Completed' , 'Defaulted') order by name");
$grid->setColProperty("candidate3id", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Candidate3 Name", "edittype" => "select"));
$grid->setSelect("candidate3id", "select null as id, '' as name from dual union SELECT distinct candidateid as id, name as name FROM candidate where status not in ('Discontinued' , 'Completed' , 'Defaulted') order by name");
$grid->setColProperty("candidate4id", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Candidate4 Name", "edittype" => "select"));
$grid->setSelect("candidate4id", "select null as id, '' as name from dual union SELECT distinct candidateid as id, name as name FROM candidate where status not in ('Discontinued' , 'Completed' , 'Defaulted') order by name");
$grid->setColProperty("candidate5id", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Candidate5 Name", "edittype" => "select"));
$grid->setSelect("candidate5id", "select null as id, '' as name from dual union SELECT distinct candidateid as id, name as name FROM candidate where status not in ('Discontinued' , 'Completed' , 'Defaulted') order by name");
コード例 #8
0
ファイル: candidate.php プロジェクト: sangikumar/IP
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
$grid = new jqGridRender($DB);
$grid->SelectCommand = 'SELECT candidateid, name, email, phone, course, batchname, enrolleddate, status, statuschangedate, processflag,diceflag, workstatus, education, workexperience, ssn, dob, portalid, wpexpirationdate,  ssnvalidated, secondaryemail, secondaryphone, address, city, state, country, zip, guarantorname, guarantordesignation, guarantorcompany, emergcontactname, emergcontactemail,  emergcontactphone, emergcontactaddrs, term, feepaid, feedue, referralid, salary0, salary6, salary12,originalresume, contracturl, empagreementurl, offerletterurl, dlurl, workpermiturl, ssnurl, notes FROM candidate';
$grid->table = 'candidate';
$grid->setPrimaryKeyId('candidateid');
$grid->serialKey = false;
$grid->dataType = 'json';
$grid->datearray = array('enrolleddate', 'wpexpirationdate', 'dob');
$grid->setUserDate("Y-m-d");
$grid->setColModel();
$grid->setUrl('../grids/candidate.php');
$grid->setColProperty("candidateid", array("editable" => false, "width" => 25, "fixed" => true, "label" => "ID"));
$grid->setColProperty("name", array("editable" => true, "frozen" => true, "width" => 200, "editoptions" => array("size" => 75, "maxlength" => 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("enrolleddate", array("formatter" => "date", "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "Enrolled 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("email", array("editable" => true, "width" => 150, "fixed" => true, "editoptions" => array("size" => 75, "maxlength" => 150), "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("course", array("editable" => true, "label" => "Course", "width" => 40, "fixed" => true, "edittype" => "select"));
$grid->setSelect("course", $courses, false, true, true, array("" => "All"));
$grid->setColProperty("status", array("editable" => true, "width" => 70, "fixed" => true, "label" => "Status", "edittype" => "select"));
$grid->setSelect("status", $candidatestatus, false, true, true, array("" => "All"));
$grid->setColProperty("statuschangedate", array("formatter" => "date", "hidden" => true, "editrules" => array("edithidden" => true, "required" => false), "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "Status Change 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("processflag", array("editable" => true, "hidden" => true, "editrules" => array("edithidden" => true, "required" => false), "label" => "Process", "width" => 50, "fixed" => true, "edittype" => "select"));
$grid->setSelect("processflag", $yesno, false, true, true, array("" => "All"));
$grid->setColProperty("diceflag", array("editable" => true, "editrules" => array("edithidden" => true, "required" => false), "label" => "Dice Candidate", "width" => 50, "fixed" => true, "edittype" => "select"));
$grid->setSelect("diceflag", $yesno, false, true, true, array("" => "All"));
$grid->setColProperty("workstatus", array("editable" => true, "width" => 70, "fixed" => true, "label" => "US Status", "edittype" => "select"));
コード例 #9
0
ファイル: leads.php プロジェクト: sangikumar/IP
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
// Create the jqGrid instance
$grid = new jqGridRender($DB);
// Write the SQL Query
$grid->SelectCommand = 'select leadid, name, startdate,course,workexperience, email, phone, secondaryemail, secondaryphone, status, priority, workstatus,spousename,spouseemail,spousephone,spouseoccupationinfo, attendedclass, siteaccess, faq, closedate, assignedto,  intent, callsmade, source, sourcename, address, city, state, country, zip, notes from leads';
// Set the table to where we add the data
$grid->table = 'leads';
$grid->gSQLMaxRows = 100000;
$grid->setPrimaryKeyId('leadid');
$grid->serialKey = false;
// set the ouput format to json
$grid->dataType = 'json';
$grid->datearray = array('closedate');
$grid->setUserDate("Y-m-d");
// Let the grid create the model from SQL query
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('../grids/leads.php');
// Change some property of the field(s)
$grid->setColProperty("leadid", array("editable" => false, "hidden" => true, "label" => "ID"));
$grid->setColProperty("name", array("editable" => true, "frozen" => true, "width" => 200, "editoptions" => array("size" => 75, "maxlength" => 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('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("course", array("editable" => true, "label" => "Course", "width" => 40, "fixed" => true, "edittype" => "select"));
$grid->setSelect("course", $courses, false, true, true, array("" => "All"));
$grid->setColProperty("workexperience", array("editable" => true, "width" => 100, "fixed" => true, "label" => "Experience"));
$grid->setColProperty("phone", array("editable" => true, "width" => 90, "editoptions" => array("size" => 75, "maxlength" => 200), "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("email", array("editable" => true, "width" => 150, "editoptions" => array("size" => 75, "maxlength" => 200), "fixed" => true, "formatter" => "email", "editrules" => array("email" => true, "required" => true), "label" => "Email*"));
コード例 #10
0
ファイル: lab.php プロジェクト: sangikumar/IP
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
// Create the jqGrid instance
$grid = new jqGridRender($DB);
// Write the SQL Query
$grid->SelectCommand = 'select machinename, type, ipaddress, teamviewerid, teamviewerpass, adminuser, adminpass, vm, vmtvid, vmtvpass, notes from lab';
// Set the table to where we add the data
$grid->table = 'lab';
$grid->setPrimaryKeyId('machinename');
$grid->serialKey = false;
// set the ouput format to json
$grid->dataType = 'json';
$grid->setUserDate("Y-m-d");
// Let the grid create the model from SQL query
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('../grids/lab.php');
// Change some property of the field(s)
$grid->setColProperty("machinename", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Name"));
$grid->setColProperty("type", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Type", "edittype" => "select"));
$grid->setSelect("type", $machinetype, false, true, true, array("" => "All"));
$grid->setColProperty("ipaddress", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "IP Address"));
$grid->setColProperty("teamviewerid", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "TV ID"));
$grid->setColProperty("teamviewerpass", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "TV Password"));
$grid->setColProperty("adminuser", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "Admin UserName"));
$grid->setColProperty("adminpass", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "Admin Password"));
$grid->setColProperty("vm", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "VM"));
$grid->setColProperty("vmtvid", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "VM TV ID"));
$grid->setColProperty("vmtvpass", array("editable" => true, "frozen" => true, "width" => 100, "fixed" => true, "label" => "VM TV Pass"));
$grid->setColProperty("printer", array("editable" => true, "frozen" => true, "width" => 70, "fixed" => true, "label" => "Printer", "edittype" => "select"));
コード例 #11
0
ファイル: grid.php プロジェクト: jewelhuq/FoodBankBooking
// Connection to the server
$conn = ADONewConnection('mysqli');
if (!$conn->Connect('localhost', DB_USER, DB_PASSWORD, 'northwind')) {
    err($conn->ErrorNo() . $sep . $conn->ErrorMsg());
}
$conn->Execute("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 SQL Data source
$table = 'products';
$grid->SelectCommand = 'SELECT * FROM ' . $table;
// set the ouput format to XML
$grid->dataType = 'json';
// Let the grid create the model
$grid->setPrimaryKeyId("ProductID");
$grid->setColModel();
$grid->table = $table;
// 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));
$grid->setColProperty("ReorderLevel", array("hidden" => true));
$grid->setColProperty("Discontinued", array("hidden" => true));
// Set the url from where we obtain the data
$grid->setUrl('grid.php');
コード例 #12
0
ファイル: batch.php プロジェクト: sangikumar/IP
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/ip-includes/gridincludes.php";
// Create the jqGrid instance
$grid = new jqGridRender($DB);
// Write the SQL Query
$grid->SelectCommand = 'SELECT batchname,current,orientationdate,subject,startdate,enddate,exams,instructor1,instructor2,instructor3,topicscovered,topicsnotcovered FROM batch';
// Set the table to where we add the data
$grid->table = 'batch';
$grid->setPrimaryKeyId('batchname');
$grid->serialKey = false;
// set the ouput format to json
$grid->dataType = 'json';
$grid->datearray = array('orientationdate', 'startdate', 'enddate');
$grid->setUserDate("Y-m-d");
// Let the grid create the model from SQL query
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('../grids/batch.php');
// Change some property of the field(s)
$grid->setColProperty("batchname", array("editable" => true, "frozen" => true, "width" => 200, "fixed" => true, "label" => "Name"));
//$grid->setSelect("batchname", $batches , false, true, true, array(""=>"All"));
$grid->setColProperty("current", array("editable" => true, "label" => "Current", "width" => 50, "fixed" => true, "edittype" => "select"));
$grid->setSelect("current", $yesno, false, true, true, array("" => "All"));
$grid->setColProperty("orientationdate", array("formatter" => "date", "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "Orientation 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("subject", array("editable" => true, "width" => 90, "fixed" => true, "label" => "Subject", "edittype" => "select"));
$grid->setSelect("subject", $courses, false, true, true, array("" => "All"));
$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("enddate", array("formatter" => "date", "width" => 70, "fixed" => true, "formatoptions" => array("srcformat" => "Y-m-d", "newformat" => "Y-m-d"), "editable" => true, "label" => "End 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("exams", array("editable" => true, "width" => 70, "fixed" => true, "editrules" => array("minValue" => 0, "maxValue" => 10), "label" => "Exams", "edittype" => "select"));
$grid->setSelect("exams", $count, false, true, true, array("" => "All"));