diff --git a/frappe/public/js/frappe/form/grid.js b/frappe/public/js/frappe/form/grid.js index a834d89bee..18cb674f78 100644 --- a/frappe/public/js/frappe/form/grid.js +++ b/frappe/public/js/frappe/form/grid.js @@ -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