No longer so sure about this. It actually looks more like the result from the search dialog re does the select on the database so it would be relevant to have the datepicker convert the date back to Y-m-d for the search which does not seem to be happening.
Please ignore this. I realise the question is irrelevant as the the search is on dates in the grid which are formatted as d/m/Y and not searching the dates in the database format.
Thank you. Now working
After trial and error and an old post this works:
In A – jQuery(‘A’).jqGrid(‘gridDnD’,{connectWith:’B,C’});
In B – jQuery(‘A’).jqGrid(‘gridDnD’,{connectWith:’A,B,C’});
In C – jQuery(‘A’).jqGrid(‘gridDnD’,{connectWith:’A,B,C’});
I have it now working. It appears not to like jQuery version 3. changed to 2.1 like demo and it works.
Many thanks indeed. That is working.
Hi Will, thank you for your replies. Unfortunately it is not working.
<?php
include_once ‘jq-config.php’;
// include the jqGrid Class
require_once “../javascript/jqgrid/php/jqGrid.php”;
// include the PDO driver class
require_once “../javascript/jqgrid/php/jqGridPdo.php”;
if(!isset($TestID) ) {
$TestID = jqGridUtils::GetParam(‘id’);
}
$id = $TestID;
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// options
$grid->setGridOptions(array(“id”=>$TestID));
// the actual query for the grid data
$grid->SelectCommand = “SELECT
tr_cyotestquestion.TestID,
tr_cyotestquestion.FixedOrder,
tr_cyoquestion.Title,
tr_cyoquestion.CYOQuestionID
FROM
tr_cyoquestion
INNER JOIN tr_cyotestquestion ON tr_cyotestquestion.CYOQuestionID = tr_cyoquestion.CYOQuestionID
WHERE
tr_cyotestquestion.FixedOrder IS NOT NULL and
tr_cyotestquestion.TestID = “.$id;
gives the error:- Syntax error or access violation 1064. Error in SQL syntax near ” ….
<?php
include_once ‘jq-config.php’;
// include the jqGrid Class
require_once “../javascript/jqgrid/php/jqGrid.php”;
// include the PDO driver class
require_once “../javascript/jqgrid/php/jqGridPdo.php”;
if(!isset($TestID) ) {
$TestID = jqGridUtils::GetParam(‘id’);
}
$id = $TestID;
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// options
$grid->setGridOptions(array(“id”=>$TestID));
// the actual query for the grid data
$grid->SelectCommand = “SELECT
tr_cyotestquestion.TestID,
tr_cyotestquestion.FixedOrder,
tr_cyoquestion.Title,
tr_cyoquestion.CYOQuestionID
FROM
tr_cyoquestion
INNER JOIN tr_cyotestquestion ON tr_cyotestquestion.CYOQuestionID = tr_cyoquestion.CYOQuestionID
WHERE
tr_cyotestquestion.FixedOrder IS NOT NULL and
tr_cyotestquestion.TestID = ?”;
gives the error:- Invalid parameter number: no parameters were bound ….
Sorry to trouble you with this but I am obviously missing the point somewhere as there must be a way of passing variables to the select statement for the grid.
Regards
Murray
Many thanks for your prompt reply, however neither suggestion works. jqGrid refuses to recognise the variable TestID on the second pass.
either using: // Set the url from where we obtain the data
$grid->setUrl(‘getTestQuestionsFO.php?id=’.$TestID);
or
<?php
include_once ‘jq-config.php’;
// include the jqGrid Class
require_once “../javascript/jqgrid/php/jqGrid.php”;
// include the PDO driver class
require_once “../javascript/jqgrid/php/jqGridPdo.php”;
if(!isset($TestID) ) {
$TestID = jqGridUtils::GetParam($TestID);
}
$id = $TestID;
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// options
//$grid->setGridOptions(array(“id”=>$TestID));
// the actual query for the grid data
$grid->SelectCommand = “SELECT
tr_cyotestquestion.TestID,
tr_cyotestquestion.FixedOrder,
tr_cyoquestion.Title,
tr_cyoquestion.CYOQuestionID
FROM
tr_cyoquestion
INNER JOIN tr_cyotestquestion ON tr_cyotestquestion.CYOQuestionID = tr_cyoquestion.CYOQuestionID
WHERE
tr_cyotestquestion.FixedOrder IS NOT NULL and
tr_cyotestquestion.TestID = “.$id;
// set the ouput format to json
$grid->dataType = ‘json’;
// Let the grid create the model
$grid->setColModel(null);
// Set the url from where we obtain the data
$grid->setUrl(‘getTestQuestionsFO.php’);
// Set some grid options
$grid->setGridOptions(array(
“caption”=>”Fixed Order questions for Test “,
“rowNum”=>20,
“sortname”=>”FixedOrder”,
“altRows”=>true,
“rowList”=>array(20,100,200),
“height”=>250,
“width”=>400
));
$grid->addCol(array(“name”=>”act”),”last”);
// Change some property of the field(s)
$grid->setColProperty(“TestID”, array(“label”=>”ID”, “width”=>25));
$grid->setColProperty(“FixedOrder”, array(“label”=>”FixedOrder”, “width”=>25, “hidden”=>true));
$grid->setColProperty(“Title”, array(“label”=>”Title”, “width”=>200));
$grid->setColProperty(“CYOQuestionID”, array(“label”=>”CYOQuestionID”, “width”=>20, “hidden”=>true));
$grid->setColProperty(“act”, array(“label”=>”Actions”, “width”=>50));
$loadevent = <<<LOADCOMPLETE
function(rowid){
var ids = jQuery(“#qfolist”).getDataIDs();
for(var i=0;i<ids.length;i++){
var rowd = $(“#qfolist”).getRowData(ids);
var cl = ids;
sh = ‘
</ids>’;
jQuery(“#qfolist”).setRowData(ids,{act:sh});
}
}
LOADCOMPLETE;
$grid->setGridEvent(“loadComplete”,$loadevent);
// Enable navigator
$grid->navigator = true;
// Disable some actions
$grid->setNavOptions(‘navigator’, array(“excel”=>false,”add”=>false,”edit”=>false,”del”=>false,”view”=>false));
// Run the script
$grid->renderGrid(‘#qfolist’,’#qfopager’,true, null,null,true,true,true);
$conn = null;
?>
I have also tried Tony’s suggested
$grid->renderGrid(‘#qfolist’,’#qfopager’,true, array($id),null,true,true,true);
with $grid->setColModel(null,array($id));
Any idea what I am doing wrong?
Thank you Tony, capitilsation changed and reserved from and to changed and it all works.
Regards
Murray
I reloaded all the js libraries and the issue seems to have dissapeared.
Sorry about the miss-named table, however the Northwind database that came with my download of jqsuite has the following tables:-
Categories, customes,employees,orders,order_details,products,shippers and suppliers but no nested_category.
Specifically where can I find documentation on what values should be in lft, rgt fields in the table in setTableConfig? Level is fairly obvious.
I have the subgrid working in other sites and see the json returned is in the same format as I describe above so I am stumped as to why it is not working here. Besides, the only control I have over the json produced is to tell the grid $grid->dataType = 'json'; . I cannot see what is different that is stopping it from working.
act: be+” “+se,
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top