Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Scott Bailey on Nov 26, 2007 08:41
open dhtmlx forum
Grid Column referece

Is there a way to reference a cell by the row id and Column Heading rather than the column index. The reason being we have a dynamic grid where according to the users preferences the columns can be in different places but the heading will always be the same
Answer posted by Stanislav on Nov 26, 2007 08:52
You can use column IDs intead of column indexes ( they are persistent per column, and can be used with different column order )
IDs for columns can be set by js api

    grid.setColumnIds(...
or if you init grid from XML as
    <column id="col1"


later you can access cells by converting IDs to indexes
    var val=grid.cells(row_id,grid.getColIndexById("col1")).getValue();