Hi Abu,
I am using bulk edit and custom buttons.
When multiple records are selected and custom button is clicked, I would like to show the edit form and update those entered values for all selected IDs.Is it possible in jqGrid.
Hi,
This is doable with bulk-edit button. Refer demos/editing/bulk-edit.php
It shows edit dialog and allow bulk edit of selected rows.
I am unable to understand the usage of custom buttons.
Hi Abu,
When I enable the bulk-edit = true option, I see Bulk Edit button on toolbar which is fine. I would like to do more operations during the bulk update.For ex, I would like to send SMS to all IDs selected during the bulk update operation in addition to updating the values for other columns in bulk edit form.
In order to implement your custom logic, you can put your code in on_update event handelr.
The on_update event handler will trigger on simple edit as well as bulk edit.
Refer demos/editing/custom-events.php
Hi Abu,
Below code is called when "send email" button is clicked.Similarly which parameter should I use to identify when bulk edit button is clicked.
if ($data["params"]["bulk"] == "send-email")
{
$selected_ids = $data["id"]; // e.g. the selected values from grid 5,7,14 (where "id" is field name of first col)
// sending email logic
$g->execute_query("UPDATE invheader SET note = 'Email Sent' WHERE id IN ($selected_ids)");
die;
}
This param["bulk"] is set when you create toolbar button using JS code.
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager',
{
'caption' : 'Email',
'buttonicon' : 'ui-icon-pencil',
'onClickButton': function()
{
fx_bulk_update("send-email"); // <—————————-
},
'position': 'last'
});
correct but "Bulk Edit" button is displayed when I just set ""bulkedit"=>true". So which param do I use.
$data["param"]["???"]
For bulk edit, no param is passed. Make a last "else" case with these "if" and it will handle the all fields bulk edit form submit.
Hello,
Refer this working e.g. https://gist.github.com/gridphp/9e819202b6f389b40455622b2dfd6775#file-bulkedit-php-L172