Hi!
I’m a month into the ERPNext customization scene and still learning the ropes.
I wanted to know if there is a way to disable reordering of rows in a grid?
Tried to write a custom script to remove the sortable-handle class using jQuery like it has been done in customize_form.js, but I can’t seem to get a reference to the row div with the sortable-handle class.
Custom Script:
frappe.ui.form.on("Sales Invoice", "refresh", function (frm) {
frm.page.body.find('[data-fieldname="taxes"] [data-idx] .data-row').removeClass("sortable-handle");
});
Reference code:
//customize_form.js (Line 46)
setup_sortable: function(frm) {
frm.doc.fields.forEach(function(f, i) {
var data_row = frm.page.body.find('[data-fieldname="fields"] [data-idx="'+ f.idx +'"] .data-row');
if(!f.is_custom_field) {
data_row.removeClass('sortable-handle');
} else {
data_row.addClass("highlight");
}
});
},
I have tried using both onload and refresh events. I have also tried using the forEach loop just like in the reference code, but without success.
Any help would be appreciated. Thanks!
Other Attempts: (Thought I’d mention these.)
frappe.ui.form.on("Sales Invoice", "refresh", function (frm) {
$('[data-fieldname="taxes"]').css("color", "red"); //Text becomes red for all rows except column headings.
});
frappe.ui.form.on("Sales Invoice", "refresh", function (frm) {
$('[data-fieldname="taxes"] [data-idx] .data-row').css("color", "red"); //No effect.
});