3.2.0

Reload data in a grid with a button

When I am trying to reload data in my grid with call to this:

table.setURL("url");
table.request();
grid.refresh();


it does not actually reloads the data, it just makes the list shorter or longer depending on the number of rows in a new CSV dataset.

Your example "examples/old/load csv.htm" does not work properly either. If you change the second dataset completely (append "1" to each company name in the companies2.csv file), you will notice that the data don't get reloaded into the grid, it just the number of rows that changes, but the data remains the same.

Please help, since this goes into production tomorrow :(
Andrew
December 9,
oops, sorry, that's a very stupid bug on my side. Here is the patch:

new AW.CSV.Table;
AW.CSV.Table.prototype.response = function(text){

    this._rows = text.split(/\r*\n/);
    this._data = []; // missing in beta3

    if (this.$owner) {
        this.$owner.clearSelectionModel();
        this.$owner.clearSortModel();
        this.$owner.clearRowModel();
        this.$owner.setRowCount(this.getCount());
        this.$owner.refresh();
    }
};
Alex (ActiveWidgets)
December 9,
How should I apply this patch ? in my code or it can be put somewhere else within javascript code ?
Andrew
December 9,
Thanks for the patch. I applied it in my method, but how do I make it global ?

Looks like there is another bug here:

when I scroll down the grid and try to update it with my button - it does not show any new rows until you scroll it back up, so for user it is unclear either grid got reloaded or not.

Thanks,
Andrew.
Andrew
December 9,
Yes, it looks like I should clear the scroll properties as well, so here is the corrected code:

new AW.CSV.Table;
AW.CSV.Table.prototype.response = function(text){

    this._rows = text.split(/\r*\n/);
    this._data = []; // missing in beta3

    if (this.$owner) {
        this.$owner.clearScrollModel(); // missing in beta3
        this.$owner.clearSelectionModel();
        this.$owner.clearSortModel();
        this.$owner.clearRowModel();
        this.$owner.setRowCount(this.getCount());
        this.$owner.refresh();
    }
};


To apply the patch you should include this code fragment at the end of aw.js file or anywhere in your code before you create your first AW.CSV.Table object. The code modifies AW.CSV.Table.prototype so the change will be applied to all AW.CSV.Table objects.
Alex (ActiveWidgets)
December 9,

This topic is archived.

See also:


Back to support forum