Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by JT on Feb 23, 2008 09:56
open dhtmlx forum
getElementByID

Hi Everyone;

Many of the examples for the grid show the use of getElementByID. One example shows how to add a second header row and in one of the cells for that new row to put a div tag and then a few lines of code later appends to that tag a text box (I'm not showing that below).

Anyway, it appears that getElementID does not work in ie 6.0.2 when the div tag is in the col header? in the following snippet of code, var x always evaluates to null. I've tried putting text boxes and labels within the div tag, as opposed to the href shown here. Any ideas as to a work around?

mygrid.attachHeader("#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,<div id='startDateAllLink'><a href='#' onclick='copyStartDates()'>set date for all</a></div>,<div id='startDateAllLink'><a href='#' onclick='copyEndDates()'>set date for all</a></div>,#rspan,#rspan");

var x = document.getElementById('startDateAllLink');
    alert("id = " +x);

Thanks - Joe
Answer posted by Support on Feb 25, 2008 08:07
Actually getElementById must work , but the next is possible.

a) the grid is not rendered yet  - the content of header will be created only after grid.init call, before this moment it not exists, so it can't be located by getElementById
b) In case of split, elements in left part of header can be not locatable by getElementById

If problem still occurs for you - please provide full js code used for grid initialization.
Answer posted on Feb 25, 2008 08:32
Thanks Very much.  It is now working!