?> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> <div class="container"> <div class="row"> <div class="col-md-12" id="clientDiv"> <?php $mysqli = MysqliConfiguration::getMysqli(); /*phpgrid.com/documentation/*/ $dg = new C_DataGrid("SELECT * FROM clients", "rowId", "clients"); $dg->set_multiselect(true); $dg->enable_search(true); //$dg->enable_export('EXCEL'); $dg->set_pagesize(100); $dg->enable_edit('INLINE', 'D'); $dg->display(); ?> <button type="button" onclick="saveSelectedRows();">Create Job Files</button> </div> <div class="row"> <div class="col-lg-12" id="outputDiv"> </div> </div>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Add Click Event to Hyperlink</title> </head> <body> <?php $dg = new C_DataGrid("select * from products", "productCode", "products"); $dg->set_col_title("productCode", "Product Code"); $dg->set_col_title("productName", "Product Name"); $dg->set_col_title("productLine", "Product Line"); $dg->set_col_format("productLine", "showlink", array("baseLinkUrl" => "javascript:", 'target' => '_self', "showAction" => "myFunction(jQuery('#products'),'", "addParam" => "');")); $dg->set_col_format("productName", "showlink", array("baseLinkUrl" => "javascript:", 'target' => '_self', "showAction" => "phpGridSiteAjaxSearch(jQuery('#products'),'", "addParam" => "');")); $dg->display(); ?> <script type="text/javascript"> myFunction = function (grid,param) { var ar = param.split('='); if (grid.length > 0 && ar.length === 2 && ar[0] === '?id') { var rowid = ar[1]; var prodDesc = grid.getCell(rowid, 'productDescription'); alert(prodDesc); }
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> </head> <body> <h1>Filter Datagrid on Page Load</h1> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // enable integrated search $dg->enable_search(true); // use postData to filter grid during page load. // Note that the filters must be passed as string to data.php via POST, so not possible to use set_grid_property function $dg->cust_prop_jsonstr = 'postData: {filters: \'{"groupOp":"AND","rules":[{"field":"status","op":"eq","data":"Shipped"}]}\'},'; $dg->set_grid_property(array('search' => true)); $dg->display(); ?> </body> </html>
<?php //include('../../Glimpse/index.php'); require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Custom Datagrid Column Property</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->set_row_color('yellow', 'blue', 'lightgray'); $dg->set_col_property("orderNumber", array("name" => "Order Number", "width" => 40)); // display time only $dg->set_col_property("orderDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "ISO8601Short", "newformat" => "g:i A"))); $dg->enable_edit('FORM'); $dg->display(); ?> </body> </html>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpGrid Edit Form Layout</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); // hide a column $dg->set_col_hidden("requiredDate"); // enable edit $dg->enable_edit("FORM", "CRUD"); $dg->set_col_property("orderNumber", array("formoptions" => array("rowpos" => 1, "colpos" => 1))); $dg->set_col_property("orderDate", array("formoptions" => array("rowpos" => 1, "colpos" => 2))); $dg->set_col_property("requiredDate", array("formoptions" => array("rowpos" => 2, "colpos" => 1))); $dg->set_col_property("shippedDate", array("formoptions" => array("rowpos" => 2, "colpos" => 2))); $dg->set_col_property("status", array("formoptions" => array("rowpos" => 3, "colpos" => 1))); $dg->set_col_property("customerNumber", array("formoptions" => array("rowpos" => 3, "colpos" => 2))); $dg->set_col_property("comments", array("formoptions" => array("rowpos" => 4, "colpos" => 1))); $dg->set_form_dimension(700, 300);
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Load Grid using vertical scroll</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); // hide a column $dg->set_col_hidden("requiredDate"); // change default caption $dg->set_caption("Orders List"); // set export type $dg->enable_export('EXCEL'); // enable integrated search $dg->enable_search(true); // set height and weight of datagrid $dg->set_dimension(800, 600); // increase pagination size to 40 from default 20 $dg->set_pagesize(40);
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Grid Caption</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); // hide a column $dg->set_col_hidden("requiredDate"); // change default caption $dg->set_caption("Orders List"); $dg->display(); ?> </body> </html>
require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Multiple Datagrids</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", 'orders'); $dg->enable_edit("FORM", "CRUD"); $dg->display(); $dg2 = new C_DataGrid("select * from employees", "employeeNumber", "employees"); $dg2->enable_edit("FORM", "CRUD"); $dg2->display(); $dg3 = new C_DataGrid("select * from offices", "officeCode", "offices"); $dg3->enable_edit("FORM", "CRUD"); $dg3->display(); $dg4 = new C_DataGrid("select * from productlines", "productLine", "productlines"); $dg4->enable_edit("FORM", "CRUD"); $dg4->display(); $dg5 = new C_DataGrid("select * from customers", "customerNumber", "customers"); $dg5->enable_edit("FORM", "CRUD"); $dg5->display(); ?> </body> </html>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Hiden Columns</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); // hide a column $dg->set_col_hidden("requiredDate"); $dg->set_col_hidden("orderDate"); $dg->enable_export('HTML'); $dg->display(); ?> </body> </html>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Data Formatting</title> </head> <body> <?php $dg = new C_DataGrid("select * from products", "productCode", "productcode"); $dg->set_col_title("productCode", "Product Code"); $dg->set_col_title("productName", "Product Name"); $dg->set_col_title("productLine", "Product Line"); // display static Url $dg->set_col_link("productUrl"); // display dynamic url. e.g.http://www.example.com/?productCode=101&foo=bar $dg->set_col_dynalink("productCode", "http://www.example.com/", "productCode", '&foo=bar'); // column format $dg->set_col_currency("buyPrice"); $dg->set_col_format("quantityInStock", "integer", array("thousandsSeparator" => ",", "defaultValue" => "0")); $dg->set_col_format("MSRP", 'currency', array("prefix" => "\$", "suffix" => '', "thousandsSeparator" => ",", "decimalSeparator" => ".", "decimalPlaces" => '2', "defaultValue" => '0.00')); // the above line is equivalent to the following helper function $dg->set_col_currency("MSRP", "\$", '', ",", ".", "2", "0.00"); $dg->display(); ?> </body>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PHP Datagrid - Set Column Alignment</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->set_col_align("status", "center"); $dg->set_col_align("customerNumber", "right"); $dg->display(); ?> </body> </html>
require_once "C:/inetpub/wwwroot/phpGrid/conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Fomrstack Database</title> </head> <body> <img src="http://54.84.139.183/formstackdb/images/InhouzLogo.jpg" alt="InHouzLogo.jpg" style="width:195px;height:78px;"> <?php // Always the first line in the grid section $dg = new C_DataGrid("SELECT * FROM formstack", "pk", "formstack"); // change default caption $dg->set_caption("Orders List"); // change column titles $dg->set_col_title("pk", "Row No."); $dg->set_col_title("OrderNumber", "Order Number"); $dg->set_col_title("DateTime", "Date Time"); $dg->set_col_title("FirstName", "First Name"); $dg->set_col_title("LastName", "Last Name"); $dg->set_col_title("Address1", "Address 1"); $dg->set_col_title("Address2", "Address 2"); $dg->set_col_title("AddressCity", "City"); $dg->set_col_title("AddressState", "State"); $dg->set_col_title("AddressZip", "Zip"); $dg->set_col_align('email', 'EMail'); $dg->set_col_title("InstallerRating", "Installer Rating");
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Display Dynamic Hyperlink</title> </head> <body> <?php $dg = new C_DataGrid("select * from products", "productCode", "productcode"); $dg->set_col_title("productCode", "Product Code"); $dg->set_col_title("productName", "Product Name"); $dg->set_col_title("productLine", "Product Line"); // display static Url $dg->set_col_link("productUrl"); // display dynamic url. e.g.http://www.example.com/?productCode=101&foo=bar $dg->set_col_dynalink("productCode", "http://www.example.com/", array('productCode', 'productScale', 'buyPrice'), '&foo=bar', '_new'); // display dynamic url from with id from another column $dg->set_col_dynalink("productLine", "http://www.example.com/", "productName", "&foo=bar"); $dg->display(); ?> </body> </html>
| | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', function () { return view('welcome'); }); /** * Special route for using PHP Data Grid to display "dashboard" list of users. * See http://www.codeproject.com/Articles/1006057/phpGrid-Laravel-and-Bootstrap for details. */ Route::get('dashboard', function () { require_once public_path() . '/assets/plugins/phpGrid_Lite/conf.php'; $dg = new C_DataGrid("SELECT * FROM users", "id", "users"); $dg->enable_edit("INLINE", "CRUD"); $dg->enable_autowidth(true)->enable_autoheight(true); $dg->set_theme('cobalt-flat'); $dg->display(false); $grid = $dg->get_display(true); return view('dashboard', array('grid' => $grid)); }); // Provide controller methods with model object instance instead of ID // by using route-model binding Route::model('projects', 'Project'); Route::model('tasks', 'Task'); Route::model('users', 'User'); Route::bind('projects', function ($value, $route) { return App\Project::whereSlug($value)->first(); });
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpGrid Virtual Column (Calculated Column)</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->enable_edit('INLINE'); // creating a virtual column $col_formatter = <<<COLFORMATTER function(cellvalue, options, rowObject){ \tvar n1 = parseInt(rowObject[0],10), \t\tn2 = parseInt(rowObject[6],10); \treturn n1+n2; } COLFORMATTER; $dg->add_column('total', array('name' => 'total', 'index' => 'total', 'width' => '360', 'align' => 'right', 'formatter' => $col_formatter), 'Total (Virtual)'); $dg->display(); ?> Virtual Column <ul> <li>The col_name cannot contain space and must begin with a letter <li>Use "formatter" column property to hook up javascript function
</ul> </li> <li><a href="404.html">Shop</a></li> <li><a href="contact-us.html">Contact</a></li> </ul> </div> </div> <div class="col-sm-3"> <div class="search_box pull-right"> <input type="text" placeholder="Search"/> </div> </div> </div> </div> </div><!--/header-bottom--> </header><!--/header--> <div class="container"> <div class="row row-centered"> <div class="col-md-8 col-centered"> <?php $dg = new C_DataGrid("SELECT * FROM ratings_list", "fideid", "ratings_list"); $dg->enable_advanced_search(true); $dg->set_caption(''); $dg->display(); ?> </div> </div> </div> </body> </html>
console.log(status); console.log(rowid); var ids = jQuery("#orders").jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = jQuery('#orders').jqGrid ('getRowData', rowId); console.log(rowData); console.log(rowId); if(\$("#orders").jqGrid("getCell", rowId, "status") == "Shipped"){ \$("#orders").jqGrid("setCell", rowId, "actions", " zzz ", {"display":"none"}); // not possible to set value for virtual column } } } ONGRIDLOADCOMPLETE; $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->set_col_hidden('comments'); $dg->add_column("actions", array('name' => 'actions', 'index' => 'actions', 'width' => '80', 'formatter' => 'actions', 'formatoptions' => array('keys' => true)), 'Actions'); $dg->set_grid_property(array('onSelectRow' => '')); $dg->add_event("jqGridLoadComplete", $onGridLoadComplete); $dg->enable_edit('INLINE', 'CRUD'); $dg->display(); ?> </body> </html>
} header('Content-Type: text/html; charset=utf-8'); ?> <html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <head> <title> <?php echo iconv('Windows-1253', 'UTF-8', 'Προγράμματα Σχολικών Δραστηριοτήτων $prSxetos'); ?> </title> </head> <body> <?php // declare and prepare phpgrid require_once 'phpgrid/conf.php'; $dg = new C_DataGrid("SELECT id,sch1,titel FROM {$prTable}", "id", "{$prTable}"); $dg->set_locale('el'); $dg->set_caption(mb_convert_encoding("Προγράμματα Σχολικών Δραστηριοτήτων {$prSxetos}", "utf-8", "iso-8859-7")); $dg->set_col_property("id", array("name" => "A/A", "width" => 15)); //$dg ->set_col_property("done", array("name"=>"done", "width"=>15)); //$dg ->set_col_property("agree", array("name"=>"done", "width"=>15)); $dg->set_col_title("id", "A/A"); $dg->set_col_title("sch1", mb_convert_encoding("Όνομα Σχολείου", "utf-8", "iso-8859-7")); $dg->set_col_title("titel", mb_convert_encoding("Τίτλος προγράμματος", "utf-8", "iso-8859-7")); //$dg ->set_col_title("done", mb_convert_encoding("Ξεκίνησε;", "utf-8","iso-8859-7" )); //$dg ->set_col_title("agree", mb_convert_encoding("Δήλ.Ολοκλ.", "utf-8","iso-8859-7" )); $dg->enable_search(true); $dg->set_dimension(1100, 700); $dg->set_pagesize(30); $dg->set_col_dynalink("id", "prog.php", "id"); $dg->set_col_dynalink("titel", "prog.php", "id");
?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>A Basic PHP Datagrid</title> </head> <body> <table> <tr><td> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->enable_edit(); $dg->display(); ?> </td> <td> <?php $dg2 = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg2->set_jq_gridName('order2'); $dg2->set_caption("order 2"); $dg2->enable_edit(); $dg2->display(); ?> </td></tr> </table> </body> </html>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PHP Datagrid - Apply Filter Method</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->set_col_width("orderNumber", '200'); $dg->set_col_width("requiredDate", '300'); $dg->set_query_filter("status='Shipped'"); $dg->set_query_filter("YEAR(shippedDate) = 2003"); // - OR - // $dg->set_query_filter("status='Shipped' AND YEAR(shippedDate) = 2003"); $dg->display(); ?> </body> </html>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Editable Datagrid - Inline Edit Action Column</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); $dg->set_col_hidden('comments'); // enable edit $dg->enable_edit("INLINE", "CRUD"); $dg->add_column("actions", array('name' => 'actions', 'index' => 'actions', 'width' => '70', 'formatter' => 'actions', 'formatoptions' => array('keys' => true)), 'Actions'); $dg->display(); ?> </body> </html>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Employee Edit</title> </head> <body> <?php $dg = new C_DataGrid("select * from employees ", "employeeNumber", "employees"); $dg->enable_edit("INLINE", "CRUD"); $dg->display(); ?> </body> </html>
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PHP Datagrid - Locale Setting</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->set_locale('fr'); $dg->enable_edit('FORM'); //$dg->set_col_format('orderDate', 'date', array('srcformat'=>'Y-m-d','newformat'=>'d/m/Y')); $dg->display(); ?> </body> </html>
<?php //include('../../Glimpse/index.php'); require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>A Basic PHP Datagrid</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $onSelectRow = <<<ONSELECTROW function(status, rowid) { \talert('event 1'); \tconsole.log(rowid); \tconsole.log(status); } ONSELECTROW; $onSelectRow2 = <<<ONSELECTROW2 function(status, rowid) { \talert('event 2'); \tconsole.log("here"); } ONSELECTROW2; $rowattr = <<<ROWATTR function (rowData, inputRowData)
$dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); // hide a column $dg->set_col_hidden("requiredDate"); // change default caption $dg->set_caption("Orders List"); // EXCEL export $dg->enable_export('PDF'); $dg->display(); echo '<h2>EXCEL Export</h2>'; $dg2 = new C_DataGrid("select * from customers", "customerNumber", "Customers"); // PDF export $dg2->enable_export('EXCEL'); $dg2->display(); echo '<h2>Export Dropdown (PDF, EXCEL, HTML, CSV)</h2>'; $dg3 = new C_DataGrid("SELECT * FROM products", "productCode", "products"); $exportDropdown = <<<EXPORTDROPDOWN \$('#products_pager1_left').append ('<div style=padding-right: 16px;>Export:\\ <select onchange=document.location.href=this.options[this.selectedIndex].value;>\\ <option>---</option>\\ <option value=/phpGridx/export.php?gn=products&export_type=excel>Excel</option>\\ <option value=/phpGridx/export.php?gn=products&export_type=pdf>PDF</option>\\ <option value=/phpGridx/export.php?gn=products&export_type=html>HTML</option>\\ <option value=/phpGridx/export.php?gn=products&export_type=csv>CSV</option>\\ </select></div>'); EXPORTDROPDOWN; $dg3->before_script_end = $exportDropdown; $dg3->display(); ?> <script> </script>
<?php //include('../../Glimpse/index.php'); require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>A Basic PHP Datagrid</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->display(); ?> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Select Multiple Rows</title> <script type="text/javascript"> function ShowSelectedRows(){ var rows = getSelRows(); alert(rows); } </script> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); // hide a column $dg->set_col_hidden("requiredDate"); // enable edit $dg->enable_edit("INLINE", "CRUD"); // read only columns, one or more columns delimited by comma $dg->set_col_readonly("orderDate, customerNumber"); // required fields $dg->set_col_required("orderNumber, customerNumber"); // multiple select $dg->set_multiselect(true);
function price_validation1(value, colname) { if(value < 0){ return [false,colname + " must be zero a positive integer."]; } return [true, ""]; } // validation (INLINE only) function price_validation2(value, colname) { var rowId = jQuery("#products").jqGrid('getGridParam','selrow'); if(parseFloat(jQuery('#' + rowId + '_' + 'buyPrice').val()) > parseFloat(jQuery('#' + rowId + '_' + 'MSRP').val())) return [false,"buyPrice must be equal or less than MSRP."]; else return [true,""]; } // validation (FORM only) function price_validation3(value, colname) { if(parseFloat(jQuery('#buyPrice').val()) > parseFloat(jQuery('#MSRP').val())) return [false,"buyPrice must be equal or less than MSRP."]; else return [true,""]; } </script> <?php $dg = new C_DataGrid("SELECT * FROM products", "productCode", "products"); $dg->enable_edit('FORM'); $dg->set_col_customrule('quantityInStock', 'price_validation1'); $dg->set_col_customrule('buyPrice', 'price_validation3'); $dg->display();
//// enable integrated search //$dg -> enable_search(true); // //$dg->ud_params = 'recreateFilter:true,'; //$dg->enable_advanced_search(true); // //$dg->cust_prop_jsonstr = 'postData: {filters: // \'{"groupOp":"AND","rules":[{"field":"status","op":"eq","data":"Open"}]}\'},'; //$dg->set_grid_property(array('search'=>true)); //$dg -> display(); ?> <?php $dg = new C_DataGrid("select * from employees", array("employeeNumber", "lastName"), "employees"); $dg->enable_edit("FORM", "CRU"); //$dg -> set_col_hidden('employeeNumber',true); $dg->enable_kb_nav(true); /* * $dg -> set_col_edittype("isActive", "checkbox","1:0"); //$dg -> set_col_edittype("officeCode", "select", "1:San Francisco;2:Boston;3:NYC;4:Paris;5:Tokyo;6:Sydney;7:London"); $dg -> set_col_edittype("officeCode", "select", "Select officeCode,city from offices",false); $dg -> set_col_edittype("reportsTo", "select", "Select employeeNumber, lastName from employees",false); $dg -> set_row_color('lightyellow', 'yellow', '#F1F7F9'); $dg->enable_search(true); $dg->enable_advanced_search(true); //$dg->set_selectnetsted('officeCode', 'reportsTo'); $dg->enable_columnchooser(); */
<?php require_once "../conf.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Change Column Name</title> </head> <body> <?php $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); // change column titles $dg->set_col_title("orderNumber", "Order No."); $dg->set_col_title("orderDate", "Order Date"); $dg->set_col_title("shippedDate", "Shipped Date"); $dg->set_col_title("customerNumber", "Customer No."); $dg->display(); ?> </body> </html>