First commit for this branch, to allow removing of columns in table transformation

This commit is contained in:
slqgsm
2016-07-28 21:44:07 +00:00
parent 82eebf64b6
commit e420bee2ab
+21 -2
View File
@@ -152,8 +152,27 @@ transformers['table'] = {
throw {message: 'Query result is not in table format, try using another transform.'};
}
model.columns = data[0].columns;
model.rows = data[0].rows;
var i,j,k, entry;
if (panel.columns.length === 0) {
for (i = 0; i < data[0].columns.length; i++) {
panel.columns.push({ text: data[0].columns[i].text, value : data[0].columns[i].text});
}
}
var indices = [];
for (i = 0; i < panel.columns.length; i++) {
var column = _.findWhere(data[0].columns, { "text" : panel.columns[i].text });
indices.push(_.indexOf(data[0].columns, column));
model.columns.push(column);
}
for (i = 0; i < data[0].rows.length; i++) {
entry = [];
for (j = 0; j < indices.length; j++) {
entry.push(data[0].rows[i][indices[j]]);
}
model.rows.push(entry);
}
}
};