Merge branch 'master' of github.com:webnotes/wnframework

This commit is contained in:
Rushabh Mehta 2013-07-26 11:22:01 +05:30
commit ea25409d3b
3 changed files with 20 additions and 5 deletions

View file

@ -261,6 +261,14 @@ _f.Frm.prototype.call = function(opts) {
}
opts.original_callback && opts.original_callback(r);
}
} else {
opts.original_callback = opts.callback;
opts.callback = function(r) {
if(!r.exc) me.refresh_fields();
opts.original_callback && opts.original_callback(r);
}
}
wn.call(opts);
}

View file

@ -33,7 +33,7 @@ wn.ui.form.Grid = Class.extend({
grid: this
});
},
refresh: function() {
refresh: function(force) {
!this.wrapper && this.make();
var me = this,
$rows = $(me.parent).find(".rows"),
@ -43,7 +43,7 @@ wn.ui.form.Grid = Class.extend({
this.display_status = wn.perm.get_field_display_status(this.df, this.frm.doc,
this.perm);
if(this.data_rows_are_same(data)) {
if(!force && this.data_rows_are_same(data)) {
// soft refresh
this.header_row.refresh();
$.each(this.grid_rows, function(i, g) {
@ -117,8 +117,16 @@ wn.ui.form.Grid = Class.extend({
return data;
},
set_column_disp: function(fieldname, show) {
wn.meta.get_docfield(this.doctype, fieldname, this.frm.docname).hidden = !show;
this.refresh();
if($.isArray(fieldname)) {
var me = this;
$.each(fieldname, function(i, fname) {
wn.meta.get_docfield(me.doctype, fname, me.frm.docname).hidden = !show;
});
} else {
wn.meta.get_docfield(this.doctype, fieldname, this.frm.docname).hidden = !show;
}
this.refresh(true);
},
toggle_reqd: function(fieldname, reqd) {
wn.meta.get_docfield(this.doctype, fieldname, this.frm.docname).reqd = reqd;

View file

@ -201,7 +201,6 @@ wn.views.moduleview.ModuleView = Class.extend({
doctypes: me.doctypes
},
callback: function(r) {
console.log(r);
if(r.message) {
// reports
if(r.message.reports.length) {