3.2.0

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
October 19,
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
October 19,
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 e = this.getScrollTemplate().element();
    if (!e) {return}

    var s, x, y;

    var l = this.getScrollLeft();
    var t = this.getScrollTop();
    var w = this.getScrollWidth();
    var h = this.getScrollHeight();

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

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

    if (w < ww && h < hh){
        s = "none";
        x = 0;
        y = 0;
    }
    else if (w < ww - 16){
        s = "vertical";
        x = 20;
        y = 0;
    }
    else if (h < hh - 16){
        s = "horizontal";
        x = 0;
        y = 20;
    }
    else {
        s = "both";
        x = 20;
        y = 20;
    }

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

    if (w - l < ww - x){
        var ll = Math.max(0, w - ww + x);
        if (ll != l) {
            this.setScrollLeft(ll);
        }
    }

    if (h - t < hh - y){
        var tt = Math.max(0, h - hh + y);
        if (tt != t ) {
            this.setScrollTop(tt);
        }
    }

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

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 e = this.getScrollTemplate().element(); 
            if (e) { 
                e.lastChild.style.width = (ww-20) + "px"; 
                e.lastChild.style.height = (hh-20) + "px"; 
                e = null; 
            } 
        }); 
    }


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

This topic is archived.

See also:


Back to support forum