Hi, thank you again for helping yesterday Abu.
I'm trying to edit in the table but I'm getting a sql syntax err. When I look at it the unique err in query that i can detect it's in "at line 1 – UPDATE SET" the grid didn't insert the table name $t2 in the query.
$grid->table = $t2;
$a->select_command = "SELECT $t1.Contract, $t1.Name, $t1.Text, $t2.ID, $t2.Model FROM $t1 INNER JOIN $t2 WHERE $t1.Contrat = $t2.Contrat ";
[…]
$col = array();
$col["title"] = "Model";
$col["name"] = "Model";
$col["dbname"] = "$t2.Model";
$col["editable"] = true;
$col["edittype"] = "textarea";
$col["width"] = "23";
$cols[] = $col;
$a->set_columns($cols);
Maybe I'm wrong or I'm missing something in the configuration. Could you help me?
Thank you.
Hi,
To edit fields in multiple tables, you need custom event hander like on_insert or on_update and have your php code.
Ok, so I tried to change it with a simple function:
e["on_update"] = array("update_", null, false);
$grid->set_events($e);
function update{$data}{
print_r($data);
}
I tested some times but I can't make the grid show on screen. Do I need something else ?
All following properties and methods are of jqgrid() object.
If you have variable like $a = new jqgrid(); then all following should be $a->.
$grid->table = $t2;
$a->select_command = "…";
$a->set_columns($cols);
$grid->set_events($e);
I corrected that. Thank you.
Anyway, I will try to explain it better. I have a functionally grid but, when I add:
$e["on_update"] = array("update_", null, false);
$a->set_events($e);
The grid didn't show on screen anymore, instead the program stop on "$a->set_events($e);" (I think, not totally sure) because didn't show anything of the HTML code behind the php grid-script.
Please make sure you are using full version of phpgrid library. Free version does not have this api.
Check the included jqgrid_dist.php and see if it is compressed or readable code.
If using free, The full version i.e. readable code library is in the purchased package and you need to replace old "lib" folder.