$grid[“multiselect”] = true;
$grid[“bulkedit_options”][“afterShowForm”] = “function(){ }”;
$e[“on_update”] = array(“update_data”,””,true);
$g->set_events($e);
**************
function update_data($data)
{
$g = new jqgrid(); // temp grid object to execute sql
if ($data[“params”][“bulk”] == “change-pr-pc”)
{
$selected_ids = $data[“IdEncuentro”];
$str = $data[“params”][“data”];
phpgrid_error($data);
\\ result with some rows selected, only one IdEncuentro —- Array ( [IdEncuentro] => 17962 [params] => Array ( [bulk] => cambiar-pr-pc ) )
$g->execute_query(“UPDATE CompeticionesEncuentros SET PA_ENom = ‘PC’ WHERE IdEncuentro IN ($selected_ids) AND PA_ENom=’PR'”);
Hi,
I tried to regenerate this case but it’s work as expected.
You can put debugging like following and see response:
if ($data[“params”][“bulk”] == “change-pr-pc”)
{
print_r($data);
die;
…
}
and check ajax response in browser debugger:
Hi Abu,
Sorry for the inconvenience, I think the error is a conflict with something I have in the following initial line. require_once($_SERVER[\”DOCUMENT_ROOT\”].\”/conf.php\”);
I don\’t understand how bulk edit works for me with its default function (all rows selected) and form edit, but not with specific update_data () function.
I have located the origin of the problem and I will see if I have any luck in solving it.
Thank you.
Hi Abu,
For your information, we have located the error.
In our config.php we had a security code to avoid attacks. Let’s protect certain variables and one of them is id (it only leaves a numeric value). We have noticed that in the header of the bulkedit call, our variable IdEncuentro does not pass but it is id by default, regardless of the name of the column in the grid (IdEncuentro).
When printing what we sent (phpgrid_error($data) or print_r($data);, IdEncuentro always comes out and never id.
I just share the information in case it is useful.
Now we will see why it does not work for us with 2 grids on the same page, I suppose it will be something similar.
Thanks for updating, really appreciate it.