Autocomplete : not save

QuestionsAutocomplete : not save
biowan asked 7 years ago


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.

8 Answers
Abu Ghufran answered 7 years ago


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:

biowan answered 7 years ago

Hi Abu,

No error in firebug tool. This is the reponse :

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.

Abu Ghufran answered 7 years ago

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.

biowan answered 7 years ago

Still not work.
Is it possible to print the update query ?

Abu Ghufran answered 7 years ago

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)";

biowan answered 7 years ago

Table location :
logic_num // room number, used to search when I type in autocomplete field.

Table attribution :

My select_command :
location.logic_num AS room,
FROM attribution
INNER JOIN location ON = 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 :

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.

Abu Ghufran answered 7 years ago

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.

biowan answered 7 years ago

Good, thanks Abu. I didn't see over in the demo sample that I must add the id field. It works now. Thanks a lot.

Your Answer

7 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?