From 0807016cf549b52d66610b0a9459a40327720c86 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Fri, 29 Mar 2013 01:53:16 +0100 Subject: [PATCH] printTable --- html/admin/js/bootstrap/module-internal.js | 19 +++++++++++++++---- js/common/bootstrap/module-internal.js | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/html/admin/js/bootstrap/module-internal.js b/html/admin/js/bootstrap/module-internal.js index 53ed94bd63..b7412e74f3 100644 --- a/html/admin/js/bootstrap/module-internal.js +++ b/html/admin/js/bootstrap/module-internal.js @@ -1136,18 +1136,29 @@ var pad = '...'; var descriptions, matrix, col, what, j, value; + if (columns === undefined) { + what = list[0]; + } + else if (Array.isArray(columns)) { + what = { }; + columns.forEach(function (col) { + what[col] = null; + }); + } + else { + what = columns; + } + j = 0; descriptions = [ ]; matrix = [ [ ] ]; - what = (columns === undefined ? list[0] : columns); - j = 0; - for (col in what) { + for (col in what) { if (what.hasOwnProperty(col)) { var fixedLength = null; if (columns && columns.hasOwnProperty(col) && columns[col] > 0) { fixedLength = columns[col] >= pad.length ? columns[col] : pad.length; } - descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || 0 }); + descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || col.length }); matrix[0][j++] = col; } } diff --git a/js/common/bootstrap/module-internal.js b/js/common/bootstrap/module-internal.js index 53ed94bd63..b7412e74f3 100644 --- a/js/common/bootstrap/module-internal.js +++ b/js/common/bootstrap/module-internal.js @@ -1136,18 +1136,29 @@ var pad = '...'; var descriptions, matrix, col, what, j, value; + if (columns === undefined) { + what = list[0]; + } + else if (Array.isArray(columns)) { + what = { }; + columns.forEach(function (col) { + what[col] = null; + }); + } + else { + what = columns; + } + j = 0; descriptions = [ ]; matrix = [ [ ] ]; - what = (columns === undefined ? list[0] : columns); - j = 0; - for (col in what) { + for (col in what) { if (what.hasOwnProperty(col)) { var fixedLength = null; if (columns && columns.hasOwnProperty(col) && columns[col] > 0) { fixedLength = columns[col] >= pad.length ? columns[col] : pad.length; } - descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || 0 }); + descriptions.push({ id: col, name: col, fixedLength: fixedLength, length: fixedLength || col.length }); matrix[0][j++] = col; } }