call setup in wn.ui.form.Controller's init and added clear table method in form grid
This commit is contained in:
parent
531b43ec8e
commit
c74ad7c745
2 changed files with 11 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue