diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index 74fe6284a3..0b37c609b3 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -44,6 +44,7 @@ wn.provide('wn.ui.form'); wn.ui.form.Controller = Class.extend({ init: function(opts) { $.extend(this, opts); + this.setup && this.setup(); } }); diff --git a/public/js/legacy/widgets/form/form_grid.js b/public/js/legacy/widgets/form/form_grid.js index b07913f375..3ab4088b05 100644 --- a/public/js/legacy/widgets/form/form_grid.js +++ b/public/js/legacy/widgets/form/form_grid.js @@ -246,6 +246,16 @@ _f.FormGrid.prototype.delete_row = function(dt, dn) { if(this.on_row_delete) this.on_row_delete(cur_frm.doc, dt, dn); } +_f.FormGrid.prototype.clear_table = function() { + var me = this; + $.each(this.get_children(), function(i, d) { + wn.model.clear_doc(d.doctype, d.name); + if(me.on_row_delete) me.on_row_delete(cur_frm.doc, d.doctype, d.name); + }); + this.refresh(); + this.set_unsaved(); +} + _f.FormGrid.prototype.move_row = function(up) { if(!this.check_selected()) return;