Hello,
I try to set up a page with DHTMLXGrid and DHTMLXToolbar (v.3.0 Professional edition build 110713) in Internet Explorer 8.0.6001.18702
after loading, I get the Error “javascript :Object doesn’t support this property or method” (sorry if the message is different in english IE8, I have german IE8)
With the built-in developing tools of IE8, i have identified, that the error is raised at refreshFilters(). Here’s my code:
Page:
[code]
ReisenGridReisen.js:
var toolbar;
var mygrid;
/*
Compares 2 Date-Strings
Input for a or b: DD.MM.YY or DD.MM.YYYY or DD.MM.YY, HH:MM:SS or DD.MM.YYYY, HH:MM:SS
*/
function DateComp(a,b,order)
{
var temp = a.split(", ");
var _date = temp[0].split(".")
for(i=0;i<3;i++)
{
_date[i] = parseInt(_date[i],10);
}
if(_date[2]<1900)
{
if(_date[2] <= 49)
{
_date[2]+=2000;
}
else
{
_date[2]+=1900;
}
}
a = new Date(_date[2],_date[1]-1,_date[0],0,0,0);
if(temp.length > 1)
{
var _time = temp[1].split(":")
a.setHours (parseInt(_time[0],10));
a.setMinutes(parseInt(_time[1],10));
}
temp = b.split(", ");
_date = temp[0].split(".")
for(i=0;i<3;i++)
{
_date[i] = parseInt(_date[i],10);
}
if(_date[2]<1900)
{
if(_date[2] <= 49)
{
_date[2]+=2000;
}
else
{
_date[2]+=1900;
}
}
b = new Date(_date[2],_date[1]-1,_date[0],0,0,0);
if(temp.length > 1)
{
var _time = temp[1].split(":")
b.setHours (parseInt(_time[0],10));
b.setMinutes(parseInt(_time[1],10));
}
var result = b - a;
delete a;
delete b;
if(order == "asc")
{
result *= -1;
}
return result;
}
/*
Compares 2 Currency-Strings
Input for a or b:
-,-- = not set ( in ordering lower than 0)
0,00 or 0 = 0
any other value with coma for separator of digits (eg 1234,56)
*/
function BetragComp(a,b,order)
{
var result ;
if(a == '-,--' && b == '-,--')
{
result = 0;
}
if(a == '-,--' && b != '-,--')
{
result = 1;
}
if(a != '-,--' && b == '-,--')
{
result = -1;
}
if(a != '-,--' && b != '-,--')
{
temp = a.split(",");
a = parseInt(temp[0],10);
if(temp.length > 1)
{
a += parseInt(temp[1],10)/100;
}
temp = b.split(",");
b = parseInt(temp[0],10);
if(temp.length > 1)
{
b += parseInt(temp[1],10)/100;
}
result = b-a;
}
if(order == "asc")
{
result *= -1;
}
return result;
}
/*
Evaluates Response-Values from php-Scripts
Input:
Action :
0 = Refresh of Grid
1 = Refresh of available Buttons of toolbar
Response: String, returned from PHP-Script (GetReisenXML.php, ReisenXML.php)
*/
function ResponseReader(Action,Response)
{
switch(Action)
{
case 0:
toolbar.disableItem("Vorschau");
toolbar.disableItem("Status");
toolbar.disableItem("Edit");
toolbar.disableItem("Storno");
toolbar.disableItem("Unstorno");
toolbar.disableItem("Unlock");
if(Response.xmlDoc.responseText == -1)
{
ShowMessage("Error","RefreshHasFailed");
}
else
{
mygrid.refreshFilters(); <-- this raises the error
}
break;
case 1:
toolbar.enableItem("Vorschau");
toolbar.enableItem("Status");
var status = Response.xmlDoc.responseText.split(",");
if(status[0] == 0 || status[0] == 9)
{
toolbar.enableItem("Edit");
}
else
{
toolbar.disableItem("Edit");
}
if(status[0] <= 3 && status[1] < 2)
{
toolbar.enableItem("Storno");
}
else
{
toolbar.disableItem("Storno");
}
if(status[0] == 9)
{
toolbar.enableItem("Unstorno");
}
else
{
toolbar.disableItem("Unstorno");
}
if(status[0] == 4)
{
toolbar.enableItem("Unlock");
}
else
{
toolbar.disableItem("Unlock");
}
break;
}
}
/*
Creates a popup for later usage (not finished)
*/
function ShowMessage(Type, MessageKey)
{
var lwinWidth = 400;
var lwinHeight = 200
var dhxWins= new dhtmlXWindows();
var mywin = dhxWins.createWindow("ErrorFrame",0,0,lwinWidth,lwinWidth);
if(Type == "Error")
{
mywin.setText("Error");
}
if(Type == "Error")
{
mywin.setText("Hinweis");
}
mywin.denyResize();
mywin.denyMove();
mywin.button("park").hide();
mywin.button("minmax1").hide();
mywin.attachURL("../GetWindowText.php?Key="+MessageKey);
mywin.setModal(true);
}
/*
Eventhandler for ToolbarClick
*/
function ToolbarClick(id)
{
switch(id)
{
case "Refresh":
dhtmlxAjax.get("ReisenXML.php",function(loader){ResponseReader(0,loader);});
break;
default:
ShowMessage("Error","ActionNotPossible");
break;
}
}
/*
Eventhandler for marking grid row
*/
function GridSelect(id,ind)
{
dhtmlxAjax.get("GetReisenXML.php?key=status&id="+id,function(loader) {ResponseReader(1,loader);});
}
function Build() //creates Toolbar and Grid
{
toolbar = new dhtmlXToolbarObject("toolbarObj");
toolbar.setIconsPath("../dhtmlxToolbar/samples/common/imgs/");
toolbar.addText ("info", 0, "Vorschau und Status:");
toolbar.addButton("Vorschau", 1, "Vorschau", "open.gif", "open_dis.gif");
toolbar.addButton("Status", 2, "Status", "open.gif", "open_dis.gif");
toolbar.addSeparator("Sep1", 3);
toolbar.addText ("info2", 4, "Aktionen:");
toolbar.addButton("Edit", 5, "Edit", "open.gif", "open_dis.gif");
toolbar.addButton("Storno", 6, "Storno", "save.gif", "save_dis.gif");
toolbar.addButton("Unstorno", 7, "Unstorno", "save_as.gif", "save_as_dis.gif");
toolbar.addButton("Unlock", 8, "Unlock", "save_as.gif", "save_as_dis.gif");
toolbar.addButton("Refresh", 9, "Refresh", "open.gif", "save_as_dis.gif");
toolbar.disableItem("Vorschau");
toolbar.disableItem("Status");
toolbar.disableItem("Edit");
toolbar.disableItem("Storno");
toolbar.disableItem("Unstorno");
toolbar.disableItem("Unlock");
toolbar.attachEvent("onClick",ToolbarClick);
mygrid = new dhtmlXGridObject("grid");
mygrid.setImagePath("../dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("Von,Bis, Nach, Land, Art, Betrag, RefNr, Status");
mygrid.setColSorting("DateComp,DateComp,str,str,str,BetragComp,str,str");
mygrid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro");
mygrid.setStyle("", "border: 0px;","", "");
mygrid.setSkin("light");
mygrid.load("GetReisenXML.php");
mygrid.attachEvent("onRowSelect",GridSelect);
mygrid.init();
var frameHoehe = document.body.clientHeight;
mygrid.enableAutoHeight(true,frameHoehe - 30,true);
}
ReisenXML.php: Creates a XML-File from Data of Database and stores it in an area that is not available online
GetReisenXML.php: Returns whole XML-File created by ReisenXML.php or special Cell-Values (depending on given GET-Variables)
In Firefox 3, it’s working propely, but IE8 throws that error. Why is there a bug in IE8? I can’t understand it…