コード例 #1
0
ファイル: rec_crawler.php プロジェクト: sangikumar/IP
<?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)} } );
コード例 #2
0
ファイル: grid.php プロジェクト: nong053/prototype-nnit
// Write the SQL Query
$grid->SelectCommand = 'SELECT OrderID, CustomerID, OrderDate, 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');
$grid->cacheCount = true;
// Set grid caption using the option caption
$grid->setGridOptions(array("caption" => "This is custom Caption", "rowNum" => 10, "sortname" => "OrderID", "hoverrows" => true, "rowList" => array(10, 20, 50), "postData" => array("grid_recs" => 776)));
// Change some property of the field(s)
$grid->setColProperty("OrderID", array("label" => "ID", "width" => 60, "editable" => false));
$grid->setColProperty("Freight", array("editrules" => array("number" => true, "required" => true)));
$grid->setColProperty("OrderDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "m/d/Y")));
$grid->setColProperty("CustomerID", array("editrules" => array("required" => true)));
$grid->setAutocomplete("CustomerID", false, "SELECT CustomerID, CompanyName FROM customers WHERE CompanyName LIKE ? ORDER BY CompanyName", null, true, true);
// this is only in this case since the orderdate is set as date time
$grid->setUserTime("m/d/Y");
$grid->setUserDate("m/d/Y");
$grid->setDatepicker("OrderDate", array("buttonOnly" => false));
$grid->datearray = array('OrderDate');
// navigator first should be enabled
$grid->navigator = true;
$grid->setNavOptions('navigator', array("add" => false, "edit" => false, "excel" => false));
// and just enable the inline
$grid->inlineNav = true;
$grid->renderGrid('#grid', '#pager', true, null, null, true, true);
$conn = null;