Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ossama on Dec 15, 2009 05:08
open dhtmlx forum
dhtmlxGrid 2.5 Header don't load on IE7

Hi !

When I try to test the grid on IE7 it doesn't work while it's ok on FireFox.

Here is my code :

function doOnLoad() {
    mygrid = new dhtmlXGridObject('gridbox');
    mygrid.setImagePath("resources/ajax/imgs/");
    mygrid.setHeader("xxxx,xxxx,xxxx,xxxx,xxxx");
    mygrid.setInitWidths("*,100,100,100,100");
    mygrid.setColAlign("left,right,right,right,right");
    mygrid.setColTypes("ro,ro,ro,ro,ro");
    mygrid.setColSorting("na,na,na,na,na");
    mygrid.setSkin("modern");
    mygrid.attachEvent("onRowSelect",myHandler);
    mygrid.init();
    mygrid.enablePaging(true,30,3,"pagingArea",true,"recinfoArea");
    mygrid.setPagingSkin("bricks");
mygrid.loadXML("getSelectedPage.action");
}

The warning of IE send me to this funtion of th Grid :

/**
* @desc: sets new column header label
* @param: col - header column index
* @param: label - new label for the cpecified header's column. Can contai img:[imageUrl]Text Label
* @param: ind - header row index (default is 0)
* @type: public
* @topic: 3,6
*/
this.setColumnLabel=function(c, label, ind, hdr){
var z = (hdr||this.hdr).rows[ind||1];
var col = (z._childIndexes ? z._childIndexes[c] : c);
if (!z.cells[col]) return;
if (!this.useImagesInHeader){
var hdrHTML = "<div class='hdrcell'>"
if (label.indexOf('img:[') != -1){
var imUrl = label.replace(/.*\[([^>]+)\].*/, "$1");
label=label.substr(label.indexOf("]")+1, label.length)
hdrHTML+="<img width='18px' height='18px' align='absmiddle' src='"+imUrl+"' hspace='2'>"
}
hdrHTML+=label;
hdrHTML+="</div>";

z.cells[col].innerHTML=hdrHTML;

if (this._hstyles[col])
z.cells[col].style.cssText=this._hstyles[col];
} else { //if images in header header
z.cells[col].style.textAlign="left";
z.cells[col].innerHTML="<img src='"+this.imgURL+""+label+"' onerror='this.src = \""+this.imgURL
+"imageloaderror.gif\"'>";
//preload sorting headers (asc/desc)
var a = new Image();
a.src=this.imgURL+""+label.replace(/(\.[a-z]+)/, ".des$1");
this.preloadImagesAr[this.preloadImagesAr.length]=a;
var b = new Image();
b.src=this.imgURL+""+label.replace(/(\.[a-z]+)/, ".asc$1");
this.preloadImagesAr[this.preloadImagesAr.length]=b;
}
if ((label||"").indexOf("#") != -1){
var t = label.match(/(^|{)#([^}]+)(}|$)/);
if (t){
var tn = "_in_header_"+t[2];
if (this[tn])
this[tn]((this.forceDivInHeader ? z.cells[col].firstChild : z.cells[col]), col, label.split(t[0]));
}
}
}
This particular instruction can't be executed by IE : z.cells[col].innerHTML=hdrHTML;

Thank you for your help.
Answer posted by dhxSupport on Dec 15, 2009 05:22
Are you using setColumnLabel method in your code? Be sure if this method called after mygrid.init()
Answer posted by Ossama on Dec 15, 2009 05:39

No I'm not using  setColumnLabel.

Should I add it ?

Answer posted by Ossama on Dec 15, 2009 06:02
Yes ! this method is called after the init().
Answer posted by dhxSupport on Dec 15, 2009 07:59
Please provide us complete example where we can reproduce this issue (you can send such example directly to the support@dhtmlx.com)