Bulk edit and form

QuestionsBulk edit and form
Ananda Theerthan asked 8 years ago

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.

10 Answers
Abu Ghufran answered 8 years ago

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.

Ananda Theerthan answered 8 years ago

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.

Abu Ghufran answered 8 years ago

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

Ananda Theerthan answered 8 years ago

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;
}

Abu Ghufran answered 8 years ago

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'
});

Ananda Theerthan answered 8 years ago

correct but "Bulk Edit" button is displayed when I just set ""bulkedit"=>true". So which param do I use.
$data["param"]["???"]

Abu Ghufran answered 8 years ago

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.

Ananda Theerthan answered 8 years ago

thanks, will try

Ananda Theerthan answered 8 years ago

Hi ABU,

I tried using else statement but doesnt get executed after bulk edit.

Your Answer

15 + 17 =

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?