ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: mjg77025 on December 31, 2014, 01:04:59 am
-
I am attempting the inline row editing example on the demos page and I'm getting the following response
{"data":[]} followed by an empty grid.
The only code I have changed is in the PDO portion of the PHP code and the relevant PHP portions in the JS
Here is what I have changed in the PHP:
if (isset($_SESSION["Products"])==false)
{
//add in session["Products"];
$sql = "Select ProductID, ProductName, QuantityPerUnit, UnitPrice, UnitsInStock, Discontinued from products";
$dbh = new PDO("pgsql:host=localhost;dbname=fredhost;user=control;password=remotexxx;port=5432");
$stmt = $dbh->prepare($sql);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$_SESSION["Products"]= json_encode($rows);
}
Any reason why I am not getting any data?
-
Just ensure the correct dbname and table name and print_r the $rows before hooking your code with pqgrid.
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
print_r ( $rows );
if print_r works correctly ( displays rows ), then check the session
and verify the output of
echo $sb
http://paramquery.com/pro/products/getP?pq_datatype=JSON&pq_curpage=1&pq_rpp=10&_=1420008407223
-
I got the test script to output data and now after I have corrected my PDO I get this:
{"data":[{"ProductID":1,"ProductName":"test","QuantityPerUnit":1,"UnitPrice":1,"UnitsInStock":1,"Discontinued":"true"},{"ProductID":2,"ProductName":"test2 ","QuantityPerUnit":1,"UnitPrice":2,"UnitsInStock":3,"Discontinued":"false"}]}
Followed by an empty grid.
Any thoughts?
-
Please verify that you are pointing to correct url and check the response from server in getData callback.
getData: function (response) {
alert( response );
console.log( response );
debugger;
return { data: response.data };
}
and as you are not returning any paging information in the response, so remove pageModel or set pageModel: { type: 'local' }
-
Awesome! Got it fixed!
I had deleted a character from the url in the javascript and that was causing my issues.
Are there any SQL examples available for the Update, Delete, and Edit functions?