Error with button inside panel in grid
Hi, i hav a grid using AW.Panels.Horizontal as template:
obj.setLayoutTemplate(new AW.Panels.Horizontal);
In panel top i hav:
var top = new AW.HTML.DIV;
var button = new AW.UI.Button;
button.setControlText("test");
top.setContent("btest", button);
When i click in button, i got a weird error message: "undefined... line 2885" what is wrong?
tkz.
Paulo Cesar Silva Reis (pc - casmeiron@gmail.com) Brazil.
April 19,
How do you put the 'top' DIV into the grid?
Alex (ActiveWidgets)
April 19,
Something like these...
obj.setLayoutTemplate(new AW.Panels.Horizontal);
var top = new AW.HTML.DIV;
var button = new AW.UI.Button;
button.setControlText("test");
top.setContent("btest", button);
getGrid().defineTemplate("bar01", function(){ return top;});
getGrid().setPanelHeight(50, 0);
getGrid().setPanelTemplate(function(i){
switch(i){
case 1: return this.getScrollTemplate(); break;
default:
return this.getBar01Template();
}
});
Paulo Cesar Silva Reis (pc - casmeiron@gmail.com) Brazil.
April 19,
anyone please?
Paulo Cesar Silva Reis (pc - casmeiron@gmail.com) Brazil.
April 24,
Looks like there are some problems with event routing in AW when you insert control inside a template. Try changing
top.setContent("btest", button); to
top.setContent("btest", function(){return button});
This code seem to work
var obj = new AW.UI.Grid;
obj.setCellText("cell");
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(100);
var toolbar = new AW.HTML.DIV;
var b1 = new AW.UI.Button;
b1.setControlText("Button 1");
b1.onControlClicked = function(){alert(1)};
toolbar.setContent("button1", function(){return b1});
obj.defineTemplate("toolbar", toolbar);
obj.setLayoutTemplate(new AW.Panels.Horizontal);
obj.setPanelTemplate(function(i){
switch(i){
case 0: return this.getToolbarTemplate();
case 1: return this.getScrollTemplate();
}
});
obj.setPanelHeight(30, 0);
document.write(obj);
Alex (ActiveWidgets)
April 25,
Tkz alex... working fine now.
Paulo Cesar Silva Reis (PC from Brazil).
April 25,