Merge pull request #27502 from ljain112/fix-idx-pagination

This commit is contained in:
Sagar Vora 2024-10-01 11:29:40 +05:30 committed by GitHub
commit 9dbe2571cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -123,6 +123,7 @@ export default class Grid {
this.setup_add_row();
this.setup_grid_pagination();
this.update_idx_and_name();
this.custom_buttons = {};
this.grid_buttons = this.wrapper.find(".grid-buttons");
@ -145,6 +146,17 @@ export default class Grid {
}
}
update_idx_and_name() {
this.data.forEach((d, ri) => {
if (d.idx === undefined) {
d.idx = ri + 1;
}
if (d.name === undefined) {
d.name = "row " + d.idx;
}
});
}
set_doc_url() {
let unsupported_fieldtypes = frappe.model.no_value_type.filter(
(x) => frappe.model.table_fields.indexOf(x) === -1
@ -466,12 +478,6 @@ export default class Grid {
if (!d) {
return;
}
if (d.idx === undefined) {
d.idx = ri + 1;
}
if (d.name === undefined) {
d.name = "row " + d.idx;
}
let grid_row;
if (this.grid_rows[ri] && !append_row) {
grid_row = this.grid_rows[ri];