getColumnId returnd undefined

currently I’m using the grid control, loading all row and column definitions from a php file returning an xml string.



if I call getColumnId on a valid column index I get a column id I expect.



however when I call clearAll and loadXML to refresh the data all subsiquent calls to getColumnId return ‘undefined’.



to clarify i make the calls in this order



loadXML

getColumnId, this first one works.

clearAll

loadXML

getColumnId, this one fails.

Are you using
grid.clearAll()
or
grid.clearAll(true)
?

In second case structure of grid deleted as well, info about column’s ID is deleted with the grid’s structure.

I’ll need to be more explicit I guess

grid.loadXML(data.php);
grid.getColumnId(1); //is good
grid.clearAll();
grid.loadXML(data.php);
grid.getColumnId(1); // fails

data.php always returns ’ <rows><head><column type=“ro” width=“150”>Employee</column><column type=“ro” width=“150” id=“2009-10-21”>21 OCT 2009</column><column type=“ro” width=“150” id=“2009-10-23”>23 OCT 2009</column></head><row id=" 11274" ><cell>11274</cell><cell/><cell><![CDATA[8:00 ADP/ 8:00 Timecard ]]></cell></row><row id=" 11275" ><cell>11275</cell><cell><![CDATA[5:45 ADP/ 5:15 Timecard ]]></cell><cell/></row></rows>'

note the full header block.

You always returning xml with grid structure. So to reload grid with such xml you should clear grid structure:

grid.loadXML(data.php);
grid.getColumnId(1); //is good
grid.clearAll(true);

Also you should wait till grid is initialized and loaded before calling grid.getColumnId(1):

grid.loadXML(data.php,function(){
grid.getColumnId(1);
});

Never mind I found a work around.