Filtering wasn't designed to rebuild columns on the fly, just to repopulate the data within the columns. It's pretty rare you run across a situation where you need to rebuild the columns as well as the data; in general I'd say you're trying a solution that sounds to me like you should really be using 2 instances of Filtering for. While it's theoretically possible to do, I don't see the point of doing it.
Filtering.store.clearData() will clear all of the existing data out of the underlying store and reflect those changes in the table. While you can use setData([]), I would recommend that you use clearData (different events are fired, so there's performance differences).
trt
Damn - I hate that - just posed this and found a solution -
removed
- this.fTable.store.clearData();
and replaced with
- this.fTable.columns = [];
is this correct? - or is there a method to clear the columns?
MW wrote:
Hi, just a quick question - if i want to re-use a filteringtable widget with a different dataset [ potentially different columns and rows ] - how do i clear out the columns ?
I've tried filteringtable.store.clearData();
but this throws an error -> jojo.html.setClass() failed [TypeError: node has no properties, file:
http://auroradev.net/dojo/dojo.js, line: 4679]
code fragment below:-
populate: function(data){
var rows = data["rows"];
var columns = data["columns"];
this.fTable.store.clearData(); // if removed, then columns don't reset - left in produces error
this.fTable.valueField = data["key"];
for (var x = 0; x<columns.length; x++) {
this.fTable.columns.push(this.fTable.createMetaData(columns[x]));
}
this.fTable.store.setData(rows);
}
any help much appreciated.