Skip to content

Instantly share code, notes, and snippets.

@melissathinkiq
Created October 11, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melissathinkiq/db38ec75d3215ab8c41f5de6f54f33ec to your computer and use it in GitHub Desktop.
Save melissathinkiq/db38ec75d3215ab8c41f5de6f54f33ec to your computer and use it in GitHub Desktop.
Modified save_all and edit_all functions
function save_all() {
let ids = jQuery("#tags").jqGrid("getDataIDs");
for (let id in changedIds) {
jQuery("#tags").jqGrid("saveRow", id);
}
for (let i = 0; i < ids.length; i++) {
id = ids[i];
jQuery("#edit_row_list1_"+id).show();
jQuery("#save_row_list1_"+id).hide();
}
}
function edit_all() {
let ids = jQuery("#tags").jqGrid("getDataIDs");
for (let i = 0; i < ids.length; i++) {
id = ids[i];
jQuery("#tags").editRow(id, true, function() {}, function() {
if (jQuery("#edit_row_list1_").val() != undefined) {
jQuery("#edit_row_list1_"+id).show();
jQuery("#save_row_list1_"+id).hide();
}
return true;
}, null, null, function() {
},null,
function() {
if (jQuery("#edit_row_list1_").val() != undefined) {
jQuery("#edit_row_list1_"+id).show();
jQuery("#save_row_list1_"+id).hide();
}
return true;
}
);
jQuery("#edit_row_list1_"+id).hide();
jQuery("#save_row_list1_"+id).show();
}
jQuery(".editable").on("change", function(e) {
let id = parseInt(e.target.id).toString();
if (!changedIds[id]) {
changedIds[id] = 1;
}
else {
changedIds[id]++;
}
});
// set focus on first cell
setTimeout('jQuery(".editable:first").focus()',100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment