We are upgrading our Active Widget from 1.0 to 2.6. I updated all references from grid.js/css to aw.js/css, and I still can't get it to work. Are there any other references that I need to change for these versions?
Please help, I'm completely new to this, and my familiarity with JavaScript is limited.
>> I updated all references from grid.js/css to aw.js/css
The 2.x branch is not backward compatible with 1.0 - the API is different so just replacing js/css files is not enough. You need to change your code to use the new API.
http://www.activewidgets.com/aw.ui.grid/
var myCells = [
["MSFT","Microsoft Corporation", "314,571.156"],
["ORCL", "Oracle Corporation", "62,615.266"]
];
var myHeaders = ["Ticker", "Company Name", "Market Cap."];
// create grid object
var obj = new AW.UI.Grid;
// assign cells and headers text
obj.setCellText(myCells);
obj.setHeaderText(myHeaders);
// set number of columns/rows
obj.setColumnCount(3);
obj.setRowCount(2);
// write grid to the page
document.write(obj);
Hi Alex,
Thanks for the response. I just saw it couple days ago, and have been trying to do the corresponding updates.
This is the former piece of code I had:
var header = new Active.Templates.Header;
header.setEvent("onmousedown", function(event){
if (event.button == 2 ) {
//showmenu(event,cmenu);
}
else {
this.setClass("header", "pressed");
this.timeout(function(){this.action("columnSort")});
}
});
grid.setTemplate("top/item", header);
I changed it as follows:
var header = new AW.Grid.Header;
/*
header.setEvent("onmousedown", function(event){
if (event.button == 2 ) {
//showmenu(event,cmenu);
}
else {
this.setClass("header", "pressed");
this.timeout(function(){this.action("columnSort")});
}
});
*/
grid.setTemplate("top/item", header);
And I stated getting the following error, both before and after I commented out the 'header.setEvent' code block:
this[set] is not a function
http://>server>/scripts/ActiveWidgets/runtime/lib/aw.js
Line 26
I'm not sure what the issue is here. Am I selecting the wrong function to set my headers?
Never mind. I stripped down a lot of the old code to just get the base grid going. I can build on that :-)
Yes, this is exactly what I was going to say - its better to start with a minimal working example and then gradually migrate missing features.
As for debugging I would suggest pausing on exception and then looking up call stack until you see which part of your code triggered it.