Forum
03:12
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 ). The code (var grid is the jqGrid object, with pager):
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
Most Users Ever Online: 715
Currently Online:
40 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66