Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by David Hutchings on Mar 13, 2009 20:02
open dhtmlx forum
Grid 2.1 build 90226 - setColumnHidden

We're migrating our code from 1.6 to 2.1 and noticing a strange error with hiding a column (and headers in general.)

Our grid is created with something like the following:

<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxcommon.js"></script>
<link rel="StyleSheet" href="style/dhtmlxgrid.css" type="text/css">
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxgrid.js"></script>
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxgridcell.js"></script>
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxtreegrid.js"></script>
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxtreegrid_lines.js"></script>
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxgrid_ssc.js"></script>
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxgrid_filter.js"></script>
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxgrid_json.js"></script>
<script language="javascript" type="text/javascript" src="javascript/DHTMLx/dhtmlxgrid_srnd.js"></script>

...
<div id="threadGrid" style="width:100%;height:100%;"></div>
...
<script language="javascript" type="text/javascript">
mygrid = new dhtmlXGridObject("threadGrid");
mygrid.setHeader("Hidden,1,2,3,Date");
mygrid.setInitWidths("20,18,16,90,80");
mygrid.setColTypes("ro,ro,ch,ro,ro");
mygrid.init();
mygrid.setColumnHidden(0,true);
mygrid.load(<url>,"json");
</script>

The result of the above is that the first column in the DATA is hidden, but the first column in the HEADER is not (which results in the header being mis-aligned.)
The code above works as expected if we revert the "dhtmlxgrid.js" file back to the 1.6 version.

I can't replicate this in any of the sample files included with 2.1, so I'm not sure what else to provide...

Thanks,
- Dave
Answer posted by dhxSupport on Mar 16, 2009 05:08

Please check if all of your attached files if from the latest realize.This issue can occurs if you are mixing files from 1.6 and 2.1 versions.

Answer posted by David Hutchings on Mar 16, 2009 11:07

Checked the files and they are all 2.1. Cleared cache and problem still existed.

Tracked it down to the include of a "strict" DTD definition:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

When this DOCTYPE is used, the headers have the issue mentioned above. This DOCTYPE was supported in the previous versions and is something that is required for our application.

Thanks,

- Dave