fixed print table - remove zero value columns but maintain their sequence

This commit is contained in:
Anand Doshi 2013-02-26 18:55:01 +05:30
parent ff6f014f29
commit dee3f48ed7

View file

@ -78,9 +78,16 @@ wn.print.Table = Class.extend({
});
});
this.columns = cols_with_value;
if(this.widths) this.widths = widths;
if(this.head_labels) this.head_labels = head_labels;
// remove empty cols, widths and head labels
this.columns = $.map(this.columns, function(fieldname, i) {
if(cols_with_value.indexOf(fieldname)===-1) {
if(this.widths) this.widths.splice(i, 1);
if(this.head_labels) this.head_labels.splice(i, 1);
return null;
} else {
return fieldname;
}
});
},
make: function() {