3.2.0

Please Help: "undefined is null or not an object" (IE)

I am trying to run this in a portlet, hence the funny naming. It works fine in firefox, but in IE produces the error "undefined is null or not an object"

The code is

<div align="center" id="div_grid__PositionsByDirection_WAR_chartwriter_" style="width:100%; overflow:auto;">
<script>
grid_grid__PositionsByDirection_WAR_chartwriter__data =[
[ "NORTH","1" ]
,[ "SOUTH","2" ]
,[ "EAST","3" ]
,[ "WEST","4" ]
];
var grid_grid__PositionsByDirection_WAR_chartwriter__columns = [
"DIRECTION"
,"POSITION"
];
var grid_grid__PositionsByDirection_WAR_chartwriter__columnsSentIn = [
];
//initialzie the grid
var grid__PositionsByDirection_WAR_chartwriter_ = new AW.UI.Grid;
grid__PositionsByDirection_WAR_chartwriter_.setId("grid__PositionsByDirection_WAR_chartwriter_");
grid__PositionsByDirection_WAR_chartwriter_.setColumnCount(grid_grid__PositionsByDirection_WAR_chartwriter__columns.length);
grid__PositionsByDirection_WAR_chartwriter_.setSelectionMode("single-row"); 
grid__PositionsByDirection_WAR_chartwriter_.setHeaderText(grid_grid__PositionsByDirection_WAR_chartwriter__columns);
grid__PositionsByDirection_WAR_chartwriter_.setStyle('width', '100%'); 
grid_grid__PositionsByDirection_WAR_chartwriter__dataArray = eval(grid_grid__PositionsByDirection_WAR_chartwriter__data);
grid__PositionsByDirection_WAR_chartwriter_.setSelectedRows([]);
grid__PositionsByDirection_WAR_chartwriter_.setRowCount(grid_grid__PositionsByDirection_WAR_chartwriter__dataArray.length);
grid__PositionsByDirection_WAR_chartwriter_.setCellData(grid_grid__PositionsByDirection_WAR_chartwriter__dataArray);
if (grid_grid__PositionsByDirection_WAR_chartwriter__dataArray.length < 100) {
grid__PositionsByDirection_WAR_chartwriter_.setVirtualMode(false); 
} else {
grid__PositionsByDirection_WAR_chartwriter_.setVirtualMode(true); 
}
grid__PositionsByDirection_WAR_chartwriter_.setEvent("onselectstart", "");
grid__PositionsByDirection_WAR_chartwriter_.refresh();
</script>
</div> 	
<script language="javascript">       
// document.getElementById("a_PositionsByDirection_WAR_chartwriter_tableDiv").innerHTML = a_PositionsByDirection_WAR_chartwriter_grid;
document.write(grid__PositionsByDirection_WAR_chartwriter_);
</script>


I tried using MicroSoft Script Debugger, it breaks on aw.js line 16 "if(obj["_"+parts[i]+"Content"])", obj is null.

Please Help!!
Marc
April 8,
After digging a bit, we found that this is happening when we are importing the aw.js in multiple portlets. When we import it only once per portal page it works.

We should be able to import it multiple times. Please advise
Marc
April 8,
If you include aw.js multiple times it is definitely wrong - aw.js and aw.css should be included once, preferably into the HEAD section. I believe most portals allow to configure the resource files to be loaded just once instead of in each portlet. In the worst case just wrap the content of aw.js in IF(){} statement -

if (!window.AW) {
// content of aw.js here
}

There might be another problem in your code - you put the grid into the page twice, once with <div id="grid"></div> and grid.refresh(); and then the second time with document.write(grid) statement. This might also trigger the similar error. The code assumes unique id for each AW element.
Alex (ActiveWidgets)
April 10,

This topic is archived.

See also:


Back to support forum