From dee3f48ed7b00e8d7824d0d020b2e66b497f0d44 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 26 Feb 2013 18:55:01 +0530 Subject: [PATCH] fixed print table - remove zero value columns but maintain their sequence --- public/js/wn/print/print_table.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/js/wn/print/print_table.js b/public/js/wn/print/print_table.js index 8c493ad2f6..2884ed3402 100644 --- a/public/js/wn/print/print_table.js +++ b/public/js/wn/print/print_table.js @@ -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() {