3.2.0

Grid is null or not an object (at loading)

Hello!

I was recently forced to check an old projects code, written by a colleague I never met, using widgets version 1.0.1.

I have no idea how the components work, but spending some time on the forum I found out that other people as well experienced problems, like the grid not loading correctly everytime for no apparent reason. SO here is the code emitted on my page.

I would appreciate it, if you took a brief look at it and see if there is some known work-around that I am not aware of.

Here's the code:


<!-- Grid script -->
<script>
var string = new Active.Formats.String;
var date = new Active.Formats.Date;
date.setTextFormat("d mmm");
date.setDataFormat("RFC822");
var gridPositions = new Active.Controls.Grid;
</script>

<script>
gridPositions.setColumnProperty("texts", ["Device ID", "", "???a??da", "?e????af?","?µe??µ???a","?a??t?ta","??p??es?a", ""]);
</script>
<script>
gridPositions.setRowHeaderWidth("0px");
// Event On Selection Changed
selectionChangedFunction = function(src){
findDevice(this.getDataText(gridPositions.getSelectionProperty("index"),0));
gridPositions.setAction("selectionChanged", selectionChangedFunction);
// Alternate Grid Background Colors URL:
//http://www.activewidgets.com/grid.howto.style.rows/alternate-background-colors.html

alternate = function(){
return this.getRowProperty("order") % 2 ? "#fcfaf6" : "#ffffff";
}
var row = new Active.Templates.Row;
row.setStyle('background', alternate);
gridPositions.setTemplate('row', row);

//var image = new Active.HTML.IMG;
//image.setAttribute("SRC","./Images/tbping.gif");
//image.setStyle('height',16);
//image.setStyle('width',21);
//var pingFunction = function(){pingDevice(gridPositions.getDataText(gridPositions.getSelectionProperty("index"),0),2);}
//var pingFunction = function(src){alert(src.getColumnProperty('index'));
}
//image.setEvent("onclick", pingFunction);
//gridPositions.setColumnTemplate(image,7);
// add tooltips to the first column template and data model

gridPositions.getColumnTemplate(7).setAttribute("title", function(){return this.getItemProperty("tooltipPing")});
gridPositions.defineDataProperty("tooltipPing", function(i, j){return "Ping"});

// add tooltips to the first column template and data model </script>

<script>
gridPositions.getColumnTemplate(1).setAttribute("title", function(){return this.getItemProperty("tooltipData")});
gridPositions.getColumnTemplate(2).setAttribute("title", function(){return this.getItemProperty("tooltipData")});
gridPositions.getColumnTemplate(3).setAttribute("title", function(){return this.getItemProperty("tooltipData")});
gridPositions.getColumnTemplate(4).setAttribute("title", function(){return this.getItemProperty("tooltipData")});
gridPositions.getColumnTemplate(5).setAttribute("title", function(){return this.getItemProperty("tooltipData")});
gridPositions.getColumnTemplate(6).setAttribute("title", function(){return this.getItemProperty("tooltipData")});
gridPositions.defineDataProperty("tooltipData", function(i, j){return this.getDataText(i,j)});

// Disable sorting for image columns
var _sort = gridPositions.sort;
gridPositions.sort = function(index, direction){
if (index == 7 || index == 8){
return true;
}
else {
_sort.call(this, index, direction);
}
}
// Return to the same scrolling position after refrresh
var _refresh = gridPositions.refresh;
gridPositions.refresh = function(){
var scrollbars = gridPositions.getTemplate("layout").getContent("scrollbars");
var x = scrollbars.element().scrollLeft;
var y = scrollbars.element().scrollTop;

var data = gridPositions.getTemplate("layout").getContent("data");
var data_x = data.element().scrollLeft;
var data_y = data.element().scrollTop;
gridPositions.element().runtimeStyle.visibility = "hidden";
_refresh.call(gridPositions);
// var _obj = this;
window.setTimeout(function(){
scrollbars.element().scrollLeft = x;
scrollbars.element().scrollTop = y;
data.element().scrollLeft = data_x;
data.element().scrollTop = data_y;
//gridPositions.element().runtimeStyle.visibility = "visible";
//gridPositions.element().focus();
}, 0 );
}
document.write(gridPositions);
</script>
<!-- Grid Script-->

The message some customers are seeing is "gridPositions is null or not an object" in Internet Explorer. One customer said that after uninstalling Norton Antivirus, the grid started working again! Talk about coding madness...

Cheers!
Angie
April 26,
I'm not familiar with version 1, but since you mentioned one of the Norton (Symantec) products, check out the URLs below.
Norton Internet Security seems to be aggressive in blocking things it shouldn't block.

http://www.webmasterworld.com/forum91/1696.htm
http://www.jensense.com/archives/2006/10/google_adsense_13.html
http://www.mambers.com/showthread-t_6139.html
http://www.workingwith.me.uk/blog/web_development/norton_internet_security_woes

It wouldn't surprise me at all if a Norton product was the culprit.
I had installed a McAfee product that is the equivalent of Norton Internet Security.
I was forced to uninstall it to allow me to surf javascript enabled websites in peace :)
Ankur Motreja
April 26,
Thanks a lot for your reply!

I had no idea that Norton products can cause such mess! I will checkout the links that you mention and let people know if I find a fix, or at least what exactly is causing it.
Angie
April 26,
I would agree with Ankur that antivirus tools might be the reason - one example I saw was aw.js arriving to the browser completely empty and this triggers 'AW is null or not an object' error.
Alex (ActiveWidgets)
April 26,
Try pasting the whole runtime/lib/grid.js file in your main page enclosed within <script> tags. If it works, it means it is definitely the problem with Norton Antivirus. (this is only a temporary solution -- having the grid code in a seperate .js file rather improves performance due to browser cache techniques).

Another silly reason i could think of is pointing the grid.js file to a local path (like say, C:\ or http://localhost/ ) or even a typo, so not making it work for the end users.

Taking a second look it seems like your error is 'gridPositions is null or not an object' and not 'Active is null or not an object'. It might also be because of the <script> you have called. (Why are there several script tags -- do all of them belong to the same page? If yes, thats good).

Hope this helps!
Neo
Neo (TrioteX)
May 26,

This topic is archived.

See also:


Back to support forum