summaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/static/js/table.js
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-06-05 12:30:12 +0100
committerAlexandru DAMIAN <alexandru.damian@intel.com>2015-06-10 15:31:12 +0100
commitfb683135348b074412da154585c75865aad1eab0 (patch)
tree6245181fcfd6a2c52e60ab5a7fe612de4ccfd972 /lib/toaster/toastergui/static/js/table.js
parent928ee3fd4b52ea14b7eb704f1f27351362a9d27a (diff)
downloadbitbake-fb683135348b074412da154585c75865aad1eab0.tar.gz
toaster: ToasterTables add computational fields
This patch adds the ability to pass a function to be computed for generating a field value in setting up a column in ToasterTables. Also adding "displayable" property that can be turned False for columns that are present in JSON data but are not part of the UI. Add the "id" column by default for all rows. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'lib/toaster/toastergui/static/js/table.js')
-rw-r--r--lib/toaster/toastergui/static/js/table.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/toaster/toastergui/static/js/table.js b/lib/toaster/toastergui/static/js/table.js
index 80e9ec239..45c61848d 100644
--- a/lib/toaster/toastergui/static/js/table.js
+++ b/lib/toaster/toastergui/static/js/table.js
@@ -110,9 +110,13 @@ function tableInit(ctx){
setupTableChrome(tableData);
/* Add table data rows */
+ var column_index;
for (var i in tableData.rows){
+ /* only display if the column is display-able */
var row = $("<tr></tr>");
+ column_index = -1;
for (var key_j in tableData.rows[i]){
+
/* if we have a static: version of a key, prefer the static: version for rendering */
var orig_key_j = key_j;
@@ -125,6 +129,12 @@ function tableInit(ctx){
key_j = "static:" + key_j;
}
+ /* we skip over un-displayable column entries */
+ column_index += 1;
+ if (! tableData.columns[column_index].displayable) {
+ continue;
+ }
+
var td = $("<td></td>");
td.prop("class", orig_key_j);
if (tableData.rows[i][key_j]){
@@ -206,6 +216,9 @@ function tableInit(ctx){
/* Add table header and column toggle menu */
for (var i in tableData.columns){
var col = tableData.columns[i];
+ if (col.displayable === false) {
+ continue;
+ }
var header = $("<th></th>");
header.prop("class", col.field_name);