diff --git a/frappe/public/js/frappe/form/grid.js b/frappe/public/js/frappe/form/grid.js index cad32954e9..cda052553f 100644 --- a/frappe/public/js/frappe/form/grid.js +++ b/frappe/public/js/frappe/form/grid.js @@ -37,6 +37,8 @@ export default class Grid { } this.is_grid = true; + this.debounced_refresh = this.refresh.bind(this); + this.debounced_refresh = frappe.utils.debounce(this.debounced_refresh, 500); } allow_on_grid_editing() { @@ -675,6 +677,7 @@ export default class Grid { if (!idx) { idx = this.grid_rows.length - 1; } + setTimeout(() => { this.grid_rows[idx].row .find('input[type="Text"],textarea,select').filter(':visible:first').focus(); @@ -934,6 +937,6 @@ export default class Grid { // update the parent too (for new rows) this.docfields.find(d => d.fieldname === fieldname)[property] = value; - this.refresh(); + this.debounced_refresh(); } }