3.2.0

Column refresh not working

I'm using the 2.0.1 trial version of the grid at the moment and can't get it to refresh a single column, although refreshing individual cells works fine. I've put this example together to illustrate my problem - can anyone tell me what I've done wrong?

var obj = new AW.UI.Grid;
    var data;
    obj.setSize(300,300);
    obj.setColumnCount(2);
    obj.setRowCount(5);
    document.write(obj);
    Populate();
    window.setTimeout(Refresh, 5000);
    
    function Populate()
    {
        data = [["A",1],["B",2],["C",3],["D",4],["E",5]];
        obj.setCellData(data);
        obj.refresh();
    }
    
    function Refresh()
    {
        data[0][1] = 3;
        data[2][1] = 1;
        //obj.getCellTemplate(1,0).refresh();
        //obj.getCellTemplate(1,2).refresh();
        obj.getCellTemplate(1).refresh();
    }
Rich
October 13,
Yes, column refresh does not work this way because there is no common parent element for all cells in the same column (the cells are inserted into row divs).

You can only refresh single cell, row or the whole grid.
Alex (ActiveWidgets)
October 13,
Of course, that makes sense. My problem is I have a column that displays how old the data is in hours and minutes and I poll every 20 seconds for new/updated data - if there are no changes I just want to refresh the Age column. Refreshing the whole grid is a bit slow, and I've also tried looping through the rows and updating the age cell for each, this is also slow. However even without any refresh code the values still update as soon as the user scrolls the grid at all. So is there a way I can determine which rows are currently displayed or rendered, and therefore only refresh those rows?
Rich
October 13,
You can find the number of rows to skip dividing the scroll offset by the row height -

getScrollTop()/getRowHeight()

In virtual mode the grid renders 20 additional rows above and below visible area.
Alex (ActiveWidgets)
October 13,

This topic is archived.

See also:


Back to support forum