Skip to content

Commit

Permalink
feat: Add on_add_row event for grid in Dialog
Browse files Browse the repository at this point in the history
- This can be used to manipulate data and add presets to the grid dynamically

(cherry picked from commit 6f6e429)
  • Loading branch information
marination authored and mergify[bot] committed May 27, 2024
1 parent 5f9157d commit 8db7fcd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frappe/public/js/frappe/form/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,9 @@ export default class Grid {
acc[d.fieldname] = d.default;
return acc;
}, {});
this.df.data.push({ idx: this.df.data.length + 1, __islocal: true, ...defaults });
let idx = this.df.data.length + 1;
this.df.data.push({ idx: idx, __islocal: true, ...defaults });
this.df.on_add_row && this.df.on_add_row(idx);
this.refresh();
}

Expand Down

0 comments on commit 8db7fcd

Please sign in to comment.