:: Forum >>
New Widget - how to start ?
I'm hoping that someone with some AAW experience can help me and point out if I am doing anything/approaching anything wrong :)
I need to write a sidebar (Windows style) widget.
I should say here that I am running a licenced copy of AW2.0
The first thing I believe I need is to subclass AW.System.Control to make my own control - say AW.Sidebar.Control
To allow AW.Sidebar to have its own namespace I have included :
if (!AW.Sidebar) {AW.Sidebar = {}}
in the namespace.js file
From this control I can 'hang' the templates and models etx that I will need to make my sidebar. Does this sound correct ? My problem is that if I try the following in my HTMl file:
var sidePane = new AW.UI.Sidebar;
I am told AW.UI.Sidebar is not an object. Here is my sidebar control.jas file in its basic shell form:
<-------------------
AW.Sidebar.Control = AW.System.Control.subclass() ;
AW.Sidebar.Control.create = function(){
var obj = this.prototype;
obj.defineTemplate("group", new AW.Tree.Group);
obj.setItemTemplate(new AW.Tree.Item);
};
AW.UI.Sidebar = AW.Sidebar.Control;
--->
What fundemental think of creating you own widgets am I missing?
Hopefully I can get this to work - and offer it back to the Friends of AW ????
Yasdnil
Monday, February 20, 2006
You need to be consistent
AW.Sidebar != AW.UI.Sidebar
var sidePane = new AW.Sidebar;
Should get rid of your error.
Tony
Monday, February 20, 2006
OK. I am slowly making progress: But I am having a problem getting sensible results froma defined model in the template class.
I have a control class and a view (Template class).
In my HTML page (wihtin <script> tags) I have :
var headings = ["test1","test2","test3","test4"] ;
var data = [ ["test1","test2","test3","test4"],
["test1A","test2A","test3A","test4A"],
["test1B","test2B","test3B","test4B"]
] ;
var sidePane = new AW.UI.Sidebar;
sidePane.setPanelHeading(headings) ;
using the FF javascript debugger I can see than that the model I have defined in my control class has been populated :
var models = {
panel : {heading:"", text:"", image:"", link:"", value: "", data:"", format:"", tooltip:"", state:"", visible:true},
};
obj.defineModel("panel", models.panel);
Also in the control class I define my Template :
obj.defineTemplate("content", new AW.Sidebar.View);
My Template contains the following in the setContent method:
var panelCount = this.getPanelProperty("heading").length;
alert(panelCount) ;
But panelCount is always 0 !!
Can anyone point out why ?
Yasdnil
Wednesday, February 22, 2006
Also...
var headings = this.getPanelProperty("heading");
x= headings[i];
alert(x) ;
is always empty - no error raised - just an empty string?
I cant see why my Template class cannot see the model contents!
This AW 2.0-standad by the way!
Yasdnil
Wednesday, February 22, 2006
This topic is archived.
Back to support forum
Forum search