3.0.0

grid cleanup between data loads

Hi everybody,

Great to see 1.0.1 at the long last, isn't it?

Hope someone can help with my question. I have a grid with fixed layout (column number, sizes, formats, headers etc) that doesn't change throughout the life of a page. The data (both number of rows and their contents) do change however when database is searched. To minimize overhead I decided to create the grid once and as the new data is ready load it and refresh. Here's what I'm doing:

// clear selections
obj.setSelectionProperty("values", []);
// set number of rows
obj.setRowCount(reclistData.length);
// load data
obj.setDataText(function(i, j){return formats[j].dataToText(reclistData[i][j])}); 
obj.setDataValue(function(i, j){return formats[j].dataToValue(reclistData[i][j])});
// select the first row 
obj.setSelectionProperty("index", 0);
// refresh
obj.refresh();


and it works nicely if I didn't use sort on the previous data. When you sort, indexes of rows get all messed up, i.e. they are not sequential anymore, 0 is not the necessarily the first row etc. I believe it's needed to retain the selections across searches. However, the messed order survives the call to
obj.setSelectionProperty("values", []);
and produces script errors when grid is refreshed (e.g. row may have an index bigger than total number of rows etc).
Looks like I'm missing something. Any suggestions?

Many thanks,
Sergei
May 3,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.