Hi,
I have a custom components that wraps a javascript object.
The emitted javascript ( from the component encodeBegin ) is something like this:
var myData = [
["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"]
];
var myColumns = [
"Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"
];
// create ActiveWidgets Grid javascript object
var obj = new AW.UI.Grid;
obj.setId("myGrid");
obj.setCellText(myData);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount(20);
obj.setColumnCount(5);
// set row selection
obj.setSelectionMode("single-row");
// set click action handler
obj.onCellClicked = function(event, col, row){window.status = this.getCellText(col, row)};
// write grid html to the page
document.write(obj);
The required javascript libraries are loaded using the a4j:loadScript element.
The problem is that if this component is rerendered it messes up the all page.
On F.F I just get a blank page.
On I.E it says "AW is not defined" which is obviously not true.
Any ideas ?
Thanks
Shandor
p.s.
After digging some more... I found that the problem is the usage of
the javascript command: document.write()
This will not be reRendered properly.
Again, Does someone know how to work around it ?
Thanks