Using jqGrid 4.8 trying to drag rows from #gavlist to #qfolist and getting error:Â Uncaught TypeError: d(…).find(…).andSelf is not a function
except for outputting an alert I see no difference between my code and the provided example that works. What am I doing wrong?
getQuestion.php – creates #qavlist
<?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”;
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// enable debugging
$grid->debug = true;
// the actual query for the grid data
$grid->SelectCommand = “SELECT
tr_cyoquestion.CYOQuestionID,
tr_cyoquestion.Title,
tr_cyoquestion.CuratorReference,
tr_cyoquestion.Question
FROM
tr_cyoquestion”;
// 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(‘getQuestions.php’);
// Set some grid options
$grid->setGridOptions(array(
“caption”=>”Available Questions”,
“rowNum”=>20,
“sortname”=>”Title”,
“altRows”=>true,
“rowList”=>array(20,100,200),
“height”=>250,
“width”=>950
));
$grid->addCol(array(“name”=>”act”),”last”);
// Change some property of the field(s)
$grid->setColProperty(“CYOQuestionID”, array(“label”=>”ID”, “width”=>30));
$grid->setColProperty(“Title”, array(“label”=>”Title”, “width”=>150));
$grid->setColProperty(“CuratorReference”, array(“label”=>”Curator”, “width”=>100));
$grid->setColProperty(“Question”, array(“label”=>”Question”,”width”=>30, “hidden”=>true, “searchoptions”=>array(“searchhidden”=>true)));
$grid->setColProperty(“act”, array(“label”=>”Actions”, “width”=>50));
//$grid->setSubGrid(“getQuestionText.php”, array(‘Question’), array(860), array(‘left’));
$loadevent = <<<LOADCOMPLETE
function(rowid){
var ids = jQuery(“#qavlist”).getDataIDs();
for(var i=0;i<ids.length;i++){
var cl = ids;
var rowd = $(“#qavlist”).getRowData(ids);
sh = ‘</ids>’;
jQuery(“#qavlist”).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(‘#qavlist’,’#qavpager’,true, null, null,true,true,true);
//$conn = null;
?>
getTestQuestionsFO.php – creates #qfolist
<?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);
// Set the url from where we obtain the data
$grid->setUrl(‘getTestQuestionsFO.php?id=’.$TestID);
// options
//$grid->setGridOptions(array(“id”=>$TestID));
// the actual query for the grid data
$grid->SelectCommand = “SELECT
tr_cyotestquestion.CYOQuestionID,
tr_cyotestquestion.FixedOrder,
tr_cyoquestion.Title
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();
// Set some grid options
$grid->setGridOptions(array(
“caption”=>”Fixed Order questions for Test “.$id,
“rowNum”=>10,
“sortname”=>”FixedOrder”,
“altRows”=>true,
“rowList”=>array(10,100,200),
“height”=>250,
“width”=>950
));
$grid->addCol(array(“name”=>”act”),”last”);
// Change some property of the field(s)
$grid->setColProperty(“CYOQuestionID”, 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(“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);
$dragdrop = <<< DRAG
jQuery(‘#qavlist’).jqGrid(‘gridDnD’,{
connectWith:’#qfolist’
});
DRAG;
// Enable navigator
$grid->navigator = true;
// Disable some actions
$grid->setNavOptions(‘navigator’, array(“excel”=>false,”add”=>false,”edit”=>false,”del”=>false,”view”=>false));
$grid->setJSCode($dragdrop);
// Run the script
$grid->renderGrid(‘#qfolist’,’#qfopager’,true, null,null,true,true,true);
$conn = null;
?>
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top