This is an odd one as this logic was working fine on the previous trirand build, but seems to cause a problem in the latest V5 from github. I have played around with the code to narrow down what makes the difference.
So the query and call to the Guriddo PHP file is as follows:
<!--?php $_SESSION['tagRef'] = $id; $_SESSION['grid_query']="select note_date,notes,ID,TagID FROM tag_notes WHERE TagID = ".$id; include_once './services/jqgrid/new_tag_notes_grid.php';?-->
Very simple and just provide the TagID – the select works fine an brings back the correct results every time.
The code in the new_tag_notes_grid.php is as follows:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<!--?php if (!isset($_SESSION['grid_query'])) { session_start(); } $_SESSION['user_type']==3 ? $editable=false : $editable = true; include __DIR__ . '/../../include/jq-config.php'; include __DIR__ . '/../../include/jq-config-calendar.php'; $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); $conn->query("SET NAMES utf8");<br ?--> // Create the jqGrid instance $conn->setAttribute( PDO::ATTR_EMULATE_PREPARES, false ); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $grid = new jqGridRender($conn); $grid->exportfile = 'ZipNFC_tag_notes_'.$_SESSION['tagRef'].'.xls'; // Set the SQL Data source $grid->serialKey = true; $grid->setPrimaryKeyId('ID'); $grid->SelectCommand = $_SESSION['grid_query']; $grid->dataType = 'json'; // Let the grid create the model $grid->table = 'tag_notes'; // define the tabel used for deleting $grid->setColModel(); $grid->setGridOptions(array( "rowNum"=>20, "search"=>false, "sortname"=>"note_date", "sortorder"=>"desc", "hoverrows"=>true, "shrinkToFit"=>true, "width"=>'100%' )); $grid->setDatepicker('note_date', array("buttonIcon"=>true,"dateFormat"=>'dd-mm-yy'), true, false); $grid->datearray = array("note_date"); $grid->setUserDate("d-m-Y"); $grid->setDbDate("Y-m-d"); $grid->toolbarfilter = true; $grid->navigator = true; $grid->setNavOptions('navigator', array("excel"=>true,"pdf"=>false, "add"=>$editable,"edit"=>$editable,"del"=>$editable,"view"=>false,"cloneToTop"=>true)); $grid->setUrl("./services/jqgrid/new_tag_notes_grid.php"); $grid->setColProperty("ID", array("hidden"=>true)); $grid->setColProperty("TagID", array("hidden"=>true)); $grid->setColProperty("TagID", array( "editrules"=>array("edithidden"=>false), "editoptions"=>array("defaultValue"=>$_SESSION['tagRef'])) ); $grid->setColProperty("note_date", array("label"=>'Date',"width"=>'50',"formatter"=>'date', "formatoptions"=>array('srcformat'=>'Y-m-d','newformat'=>'d-m-y'))); $grid->setColProperty("notes", array("label"=>'Notes',"edittype"=>'textarea',"editoptions"=>array("rows"=>10,"cols"=>40))); $grid->setNavOptions('edit',array("width"=>400,"height"=>250,"dataheight"=>'180')); $grid->setNavOptions('add',array("width"=>400,"height"=>250,"dataheight"=>'180')); $grid->renderGrid('#action_grid','#action_pager',true, null, null, true,true); $conn = null; ?> |
The issue is – if include the $grid->setColProperty(“TagID”, array(“hidden”=>true)); it hides the column as required, but you lose all the icons for add, refesh, delete etc…  if you do not hide it they appear.
What I am trying to achieve is to not show the ID and TagID fields and when in edit or new, to have the TagID in the form but not visible so gets saved back as a field. Â This used to work perfectly on the last build we were using.
Are we doing something wrong or hit on a glitch.
Many thanks – Chris.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top