3.2.0

Grid - Big problem by ordering dynamic list (with example)

I have a big problem. I created a list of online users, the number of
lines is constantly changing and by ordering some lines disappear. Isolated the
problem in the example below. Try order to test.

Help-me! What is the solution to the problem?

---------------------------------------------

var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setHeaderText(["Queue", "User", "IP", "MAC", "Download", "Upload", "Download Rate", "Upload Rate"]);
grid.setColumnIndices([0,1,3,4,5,6,7]);
grid.setColumnCount(7);
grid.refresh();

var data = new Array();

var idx = 0;
data[0] = [
[0, "user1", "172.16.0.93", "00:01:AF:0F:1F:2F", 1001, 1002, 1003, 1004],
[1, "user2", "172.16.0.193", "00:02:BF:0B:1B:2B", 1101, 1102, 1103, 1104],
[3, "user3", "172.16.10.3", "00:03:CF:0C:1C:2C", 1201, 1202, 1203, 1204],
];

data[1] = [
[2, "user1", "172.16.0.93", "00:01:AF:0F:1F:2F", 2001, 2002, 2003, 2004],
[1, "user3", "172.16.10.3", "00:03:CF:0C:1C:2C", 2101, 2102, 2103, 2104]
];

data[2] = [
[2, "user1", "172.16.0.93", "00:01:AF:0F:1F:2F", 3001, 3002, 3003, 3004],
[3, "user2", "172.16.0.193", "00:02:BF:0B:1B:2B", 3101, 3102, 3103, 3104],
[9, "user3", "172.16.10.3", "00:03:CF:0C:1C:2C", 3201, 3203, 3204, 3205]
];

data[3] = [
[9, "user2", "172.16.0.193", "00:02:BF:0B:1B:2B", 4001, 4002, 4003, 4004],
[1, "user3", "172.16.10.3", "00:03:CF:0C:1C:2C", 4101, 4102, 4103, 4204],
[3, "user4", "192.168.10.232", "00:04:DF:0D:1D:2D", 4201, 4202, 4203, 4204]
];

grid.setRowCount(data[0].length);
grid.setCellData(data[0]);
grid.refresh();

var ni = window.setInterval(function(){
idx++; if(idx>3)idx=0;

grid.setRowCount(data[idx].length);
grid.setCellData(data[idx]);
grid.refresh();
}, 2000);
Patrick
August 22,
See:
http://www.activewidgets.com/javascript.forum.24978.2/grid-distortion-after-sorting-on.html
http://www.activewidgets.com/javascript.forum.22706.1/obj-clearrowmodel-results-in-missing.html

I would clear those other models also for this case.
Note :
Remove last 'extra' comma at bottom of data[0] - ],]; - and the first grid.refresh();
HTH

var ni = window.setInterval(function(){
idx++; if(idx>3)idx=0;

grid.clearRowModel();
grid.clearScrollModel();
grid.clearSortModel();
grid.clearSelectedModel();

grid.setCellData(data[idx]);
grid.setRowCount(data[idx].length);
grid.refresh();
}, 2000);


C++
August 22,

This topic is archived.

See also:


Back to support forum