Forum


15:41

22/04/2011

Hy,
Before start sorry for language I'm french
I try tu use the queryGrid(); function but I can't make it work. Look at an example :
//code before
//define params
$param1 = 2;
//REQUETE
$grid->SelectCommand = "SELECT activite.code, activite.id_activite, travaux.id_travaux
FROM activite INNER JOIN travaux ON activite.id_activite = travaux.id_activite
WHERE travaux.id_activite = ?";
// Set the table to where you update the data
$grid->table = 'activite';
// Set output format to json
$grid->dataType = 'json';
$grid->queryGrid(null, array($param1));
//code after
The page don't load, just send me file name "*******.part"
_____________________________________________________________________________________________
But if I replace ? by my value (2) and del queryGrid() it's works, page load and grid get good value :
//code before
//REQUETE
$grid->SelectCommand = "SELECT activite.code, activite.id_activite, travaux.id_travaux
FROM activite INNER JOIN travaux ON activite.id_activite = travaux.id_activite
WHERE travaux.id_activite = 2";
// Set the table to where you update the data
$grid->table = 'activite';
// Set output format to json
$grid->dataType = 'json';
//code after
Any idea ? I have read the doc http://www.trirand.net/documen.....m and I do exactly the same things
_________________________________________________________________________________________
I add all my code when it's not work :
<?php
// INCLUDES LIB PHP FILES ***************************************************
// jqGrid.php
// jqGridPdo.php
require_once("include_php_files.php");
// START CONNEXION WHITH DB ***************************************************
$PARAM_hote = "localhost";
$PARAM_nom_bd = "cra";
$PARAM_utilisateur = "root";
$PARAM_mot_passe = "";
// try to connect with DB
try
{
$conn = new PDO('mysql:host='.$PARAM_hote.';dbname='.$PARAM_nom_bd, $PARAM_utilisateur, $PARAM_mot_passe);
}
catch(Exception $e)
{
echo "Erreur : impossible d'établir la connexion avec la base de données dans connexion_bdd_PDO : ".$e->getMessage().'<br />';
}
// GRID CONSTRUCTOR ***************************************************
$grid = new jqGridRender($conn);
//parameters
$param1 = 2;
// REQUEST
$grid->SelectCommand = "SELECT activite.code, activite.id_activite, travaux.id_travaux
FROM activite INNER JOIN travaux ON activite.id_activite = travaux.id_activite
WHERE travaux.id_activite = ?";
// The praymery key to be set
$grid->setPrimaryKeyId('activite.id_activite');
// Defines if the primary key is serial (autoincrement)
$grid->serialKey = false;
// Set the table to where you update the data
$grid->table = 'activite';
// Set output format to json
// XML or Json
$grid->dataType = 'json';
//add parameters to the requuest
$grid->queryGrid(null, array($param1));
// debug mode
$grid->debug = true;
// COLUMN HEADINGS SECTION ********************************************
// Let the grid create the model
$grid->setColModel();
// GRID OPTIONS SECTION ***********************************************
// Set the url from where we obtain the data
$grid->setUrl('AJAX/AJAX_jquery_jgrid_3.php');
// Set some grid options
$grid->setGridOptions(array( "rowNum" => 10,
"rowList" => array(10,20,30),
"sortname" => "id_activite"
));
// Set ColProperty
$grid->setColProperty( 'code' , array(
"editoptions" => array("readonly"=>true))
);
$grid->setColProperty( 'id_activite' , array( "editable" => true)
);
// EDITING SECTION *****************************************************
// Enable navigator
$grid->navigator = true;
// Enable only editing
$grid->setNavOptions('navigator', array(
"excel" => false,
"add" => false,
"edit" => true,
"del" => false,
"view" => true,
"search"=> false
));
// Close the dialog after editing
$grid->setNavOptions('edit',array(
"closeAfterEdit" => true,
"editCaption" => "Update Customer",
"bSubmit" => "Update"
));
// FIELD PROPERTIES SECTION *****************************************************
$grid->setColProperty("code", array("width"=>300));
// Enjoy
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
?>
15:31

Moderators
30/10/2007

Hello,
Please post your problem here:
Here is the forum for the Open Source version, but you use the comertial one.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
49 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66