:: Forum >> Version 2 >>

DOCTYPE and object required error in javascript

when i use this doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" >

with a grid.

the error "object required" javascript error comes out when i call more than 2 grids functions, like setRowIndices,Columnindices and refresh().

Only happens in IE.
For example:
Step1: inits functions of myGrid....
document.write(myGrid);

Step2: myGrid.setRowIndices([0,1,2,3]);
Step3: myGrid.setColumnIndices([0,1]);
Step4: myGrid.refresh(); //after this!!

the error comes out after Step4 and only with IE.
if you do only 2 actions there is no problem, but if you do more than two, one after another then the error apears.

i think that is a problem with the refresh(), maybe in IE the function is not finish the job correctly and thats became en javascript error.

PS: all the operations(in IE and FF) Step1 to Step4 are doing it ok,
only apears that javascripterror on IE.













Paul
Thursday, October 19, 2006
a way to avoid the error is puting a time out on the last line of code.
like:
Step1: inits functions of myGrid....
document.write(myGrid);
Step2: myGrid.setRowIndices([0,1,2,3]);
Step3: myGrid.setColumnIndices([0,1]);
Step4: setTimeout("myGrid.refresh();",200); //this is a Fix

putting a setTimeout in the last line, the error it disappears. BUT I THINK ITS NOT THE "IDEAL WAY"

any good solution its very welcome.
Paul
Thursday, October 19, 2006
This problem is related to the bug in overflow controller. Here is a patch (you should add this code to the end of aw.js or in your script before calling AW objects).

AW.Grid.Controllers.Overflow.adjustScrollBars = function(){

    var 
this.getScrollTemplate().element();
    if (!
e) {return}

    var 
sxy;

    var 
this.getScrollLeft();
    var 
this.getScrollTop();
    var 
this.getScrollWidth();
    var 
this.getScrollHeight();

    var 
ww e.offsetWidth;
    var 
hh e.offsetHeight;

    if (
AW.ie6 && AW.strict) {
        
this.setTimeout(function(){
            var 
this.getScrollTemplate().element();
            if (
e) {
                
e.lastChild.style.width = (ww-20) + "px";
                
e.lastChild.style.height = (hh-20) + "px";
                
null;
            }
        });
    }

    if (
ww && hh){
        
"none";
        
0;
        
0;
    }
    else if (
ww 16){
        
"vertical";
        
20;
        
0;
    }
    else if (
hh 16){
        
"horizontal";
        
0;
        
20;
    }
    else {
        
"both";
        
20;
        
20;
    }

    if (
this.getScrollBars() != s) {
        
this.setScrollBars(s);
    }

    if (
ww x){
        var 
ll Math.max(0ww x);
        if (
ll != l) {
            
this.setScrollLeft(ll);
        }
    }

    if (
hh y){
        var 
tt Math.max(0hh y);
        if (
tt != ) {
            
this.setScrollTop(tt);
        }
    }

    
this.setContentHeight(hh this.getContentHeight(0) - this.getContentHeight(2), 1);
    
this.setContentWidth(ww this.getContentWidth(0) - this.getContentWidth(2), 1);
};
 
Alex (ActiveWidgets)
Wednesday, October 25, 2006

As well as e being broken, I have also seen this fail due to ww < 20 when the grid is not visible (in my case, within a span with display:none)

if (AW.ie6 && AW.strict) { 
        
this.setTimeout(function(){ 
            var 
this.getScrollTemplate().element(); 
            if (
e) { 
                
e.lastChild.style.width = (ww-20) + "px"
                
e.lastChild.style.height = (hh-20) + "px"
                
null
            } 
        }); 
    } 

 
Solved in my application by just putting a try/catch round it.
RMA
Tuesday, January 9, 2007
Thanks, works fine. :)
Paul
Wednesday, July 18, 2007



This topic is archived.

Back to support forum

Forum search