3.0 beta 2

Refresh content in grid

I am still evaluating this grid (pretty cool so far) and I am putting together a kind of DHTML prototype. Eventually, I am thinking I will buy and use this grid in an Ajax application if I can make it work for my needs. I am curious if and how I can refresh the content in the grid without refreshing the page? I also may have a number of small JavaScript arrays of data that I want to switch among. How do I accomplish this?
Kwooda
February 6,
Every AW object has refresh() method which re-creates html and replaces the previous image using element().outerHTML property. So in the simple case calling obj.refresh() would be fine. If we are talking about the grid and you assign different data to it - it makes sense also doing one or all of the following:

obj.clearScrollModel();
obj.clearSelectionModel();
obj.clearSortModel();
obj.clearRowModel();
obj.setRowCount(...);
obj.refresh();
Alex (ActiveWidgets)
February 6,
Excellent - thanks!

Now, I am having a problem when I change the row count. My test app just uses JavaScript arrays for the data and it opens initially with 10 items in the list and the row count set to 10. I then select an option to change the row count to 25, which calls clearRowModel, then calls setCellText with a new array containing 25 items, and then calls setRowCount to change the row count. I then call clearScrollModel() (I wasn't, before, but this didn't change the problem) followed by refresh().

The new data appears, and I can scroll down using the scroll bar (only 6 rows are visible in my display), but as soon as I roll over the grid (onmouseover), the first six items of data reappear in the grid and the scroll bar ceases to function.

Any ideas?
Kwooda
February 6,
This should be >>

obj.clearScrollModel();
obj.clearSelectedModel();
obj.clearSortModel();
obj.clearRowModel();
obj.setRowCount(...);
obj.refresh();
NK
June 2,
Yes, this is the bug which affects both CSV and XML models. Will be fixed in 2.0.1.
Alex (ActiveWidgets)
June 2,
Alex,
did this get fixed in 2.0.1?

I am having to call setSelectedRows([]) in order to clear selections when changing grid content...

Eddie
July 18,
In AW2 in an editable grid after reloading different data I use obj.setSelectionMode("single-cell"). How can I do something like obj.clearSelectedModel()? Or: How can I select a (different) cell? It seems not to be possible to clear a previously selected cell.

In a "single-row" it works and you have obj.setSelectedColumns, but not (something like obj.setSelectedCells) in a "single-cell" mode?
Eric Aarts
October 6,
Found a (temporary work-around?) solution:

obj.setSelectedColumns([-1]);obj.setSelectedRows([-1]);

Alex: This is the way? Do you have a better one? Or is this a bug?
Eric Aarts
October 7,
Correction/addition for the work around:

After de clearModels() and refresh() you first have to determine the previously selected cell and setSelect this cell again. So the complete solution is:

var i=obj.getCurrentColumn(),
j=obj.getCurrentRow();
obj.setSelectedColumns([i]);
obj.setSelectedRows([j]);
obj.setSelectedColumns([-1]);
obj.seSelectedRows([-1]);

Eric Aarts
October 7,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.