Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by tep on Nov 08, 2007 19:37
open dhtmlx forum
freeze row, columns headers? clearing values of a cell and the whole table/grid

I am using grid..
i wish to have some sort of freeze panes..

how do i freeze a column?
how do i freeze a row?
how do i freeze the header?

freezing would refer to a column.row or header not moving..
example i freeze column 1, when i scroll sidewards using the scroll bar, it wont move,
on ly the other column will move sidewards and row 1 will stay put/visible.


another thing how do i clear values on the whole grid, i tried using clearAll(), but instead
of clearing the values it deleted all rows, which i tried and the documentation said.

help would be very much appreciated..
thank you..
Answer posted on Nov 09, 2007 05:54
>>how do i freeze a column?

the next command do the work
    grid.splitAt(index);
where index - index of column by which grid need to be separated
    grid.splitAt(2); - make 2 leftmost column "frozen"

>>how do i freeze a row?
    There is no such entity as frozen row, but you can add additional rows to header and footer.

>>how do i freeze the header?
    It is frozen by default, it always visible without relation to vertical scrolling state, same apply to header as well.
    You can attach additional rows to header and footer by
       grid.attachHeader(...
       grid.attachFooter(...


>>another thing how do i clear values on the whole grid, i tried using clearAll()
clearAll really delete all data from grid, including rows, if you need just clear all grid, you can use next code snippet

grid.forEachRow(function(id){
    grid.forEachCell(id,function(cell){
       cell.setValue("");
    });
});