Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Multiple row update form
16/11/2009
03:12
Avatar
yajo
Guest
Guests

Hi, I have implemented one function I think can be useful to some of you.

Let's say you want to update one cell from several rows with the same value. Now you don't need to go on editing each row:

[Image Can Not Be Found]

Works better in Firefox (amazing Surprised). The code (var grid is the jqGrid object, with pager):

grid.jqGrid('navButtonAdd', 'pager_' + grid_container.attr('id'),{
    buttonicon: 'ui-icon-check',
    title: 'Editar los registros marcados',
    caption: '',
    onClickButton: function(){
        var sel = grid.jqGrid('getGridParam', 'selarrrow');
        if (sel.length){
            grid.jqGrid('editGridRow', 'new', {
                beforeShowForm: function(form){
                    form.find(':input').attr('disabled', true).addClass('ui-state-disabled');
                    form.find('tr.FormData').each(function(index, domEle){
                        jQuery(
                            '<td class="CaptionTD ui-widget-content"><input type="checkbox" name="'
                            + jQuery(domEle).attr('id').replace(/^tr_/, 'modificar_')
                            + '"/> Modificar</td>'
                        ).appendTo(domEle).find('input').bind('change', function(event){
                            jQuery(event.target).closest('tr').find('td.DataTD :input').attr('disabled', !jQuery(event.target).attr('checked')).toggleClass('ui-state-disabled');
                        });
                    });
                    form.closest('div[id^=editmodgrid_]').find('span.ui-jqdialog-title').text('Modificar registros seleccionados');
                },
                onClose: function(formId){
                    jQuery(formId).remove();
                },
                serializeEditData: function(data){
                    data.oper = 'multiEdit';
                    data.id = String(grid.jqGrid('getGridParam', 'selarrrow'));
                    return data;
                },
                beforeCheckValues: function(data, form, mode){
                    delete data.id;
                    for (var v in data){
                        if (form.find('td.DataTD :input[id=' + v + ']').attr('disabled')) delete data[v];
                    }
                },
                afterSubmit:afterSubmitFn,
                closeAfterEdit:true,
                closeAfterAdd:true
            });
        } else {
            alert('Debes seleccionar al menos un registro');
        }
    },
    position: 'first'
});

I think it can be useful to add it to the standard jqGrid, but since then, you have it here Laugh

10/06/2010
16:48
Avatar
sici
Member
Members
Forum Posts: 3
Member Since:
24/09/2009
sp_UserOfflineSmall Offline

there is a demo online ?

please i dont now how to implement this code!

10/01/2014
11:24
Avatar
devesh13
New Member
Members
Forum Posts: 2
Member Since:
10/01/2014
sp_UserOfflineSmall Offline

I tried to implement the above code, Once I click on tickbox pop up comes up with "Add record" label with submit and cancel button ....  no editable form field coming with common cell value.. Please suggest

10/01/2014
14:12
Avatar
devesh13
New Member
Members
Forum Posts: 2
Member Since:
10/01/2014
sp_UserOfflineSmall Offline

Popup is coming up but i can't see the code to identify the uniqueness of cell values .. after implementing above code all editable cells are coming up to update irrespective of the uniqueness or not .... Please help!!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
49 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information