Hi,
I followed the example in demos/integration/autocomplete. I can search value when I tape. And when I press enter to valid changes, new value is set in the input. But when I reload the grid, it stay with the old value. The update doesn't work. To add a new item, it's same. And no error on screen.
Thanks for your help.
Hello,
It looks like you are having some query error in doing UPDATE.
Please check using firebug the UPDATE POST response.
Follow this link for debugging using firebug:
https://phpgrid.desk.com/customer/portal/articles/926266
Hi Abu,
No error in firebug tool. This is the reponse :
{"id":"'217'","success":true}
The id number is the record that I updated. But new value wasn't save, and old value is back after page reloaded.
Thanks for your help.
You can now check the REQUEST tab in firebug->net … to see what actual data is posted to server for update.
This message of success means update query went fine.
You can also email code for review at my email address.
In jqgrid_dist.php file, you can search for this line and do an echo, and check in firebug.
$sql = "UPDATE {$this->table} $update_str WHERE $pk_field IN ($id)";
Table location :
id
label
type
logic_num // room number, used to search when I type in autocomplete field.
Table attribution :
id
participant_id
location_id
My select_command :
SELECT attribution.id AS id,
attribution.participant_id,
attribution.location_id,
location.logic_num AS room,
FROM attribution
INNER JOIN location ON location.id = attribution.location_id
My location field parameters :
"title" => "Location",
"name" => "room",
"editable" => true,
"search" => true,
"dbname" => "location.logic_num",
"formatter" => "autocomplete", // autocomplete
"formatoptions" => array(
"sql" => "SELECT id as k, logic_num as v FROM location",
"search_on" => "logic_num", // I wish to know if it's possible to seach in more than 1 field. Ex : Concat(firstname, ' ', lastname) AS fullname ?
"update_field" => "location_id", // I think this value must be the field in "attribution" table field name
),
The update query from jqgrid_dist.php :
UPDATE attribution SET participant_id='487' WHERE id IN ('216')
The HTTP post query indicated by Firebug :
room=R0001&participant_id=487&oper=edit&id=216
So the value participant_id was updated, firebug print me the operation was successful is correct. Because the query works fine. But the value of the room is missing in query to update. Don't know what's wrong in my parameters.
Thanks for your help.
Please make sure you have column 'location_id' and it is set editable -> true.
$col["name"] = 'location_id';
$col["editable"] = true;
Only editable columns are posted on update. Another thing is if you are using excel view, only changed column will be posted.