Merge pull request #28955 from vishakhdesai/fix-idx-pagination

fix: update idx and name in table before rendering result rows
This commit is contained in:
Akhil Narang 2025-01-29 11:22:22 +05:30 committed by GitHub
commit 562f8212ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -203,6 +203,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");
@ -225,6 +226,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