-
2 Jun 2011 2:34 PM #1
[SOLVED] Understanding Namespace and Ext.regApplication
[SOLVED] Understanding Namespace and Ext.regApplication
Hi there,
I am having two *.js files.
1) index.js, which holds
2) helper.js which holds:PHP Code:Ext.regApplication({
name: 'dropMe',
launch: function() {
var board = new Ext.Panel
({
layout: "card",
items: [],
dockedItems: [],
});
var myBoardFiller = new fillBoard();
myBoardFiller.doTheFill();
}
But it reports back that dropMe.board is not an object.PHP Code:function fillBoard(){
this.doTheFill = function(){
var myText = new Ext.form.Text();
myText = {
name: 'textName',
label:'textLabel'
}
dropMe.board.add(myText);
}
}
Whats wrong?
Best TD
-
3 Jun 2011 12:25 AM #2
Instead of defining 'board' as a local variable you will need to define it as a property of the dropMe namespace object. So instead of "var board = ..." change it to "dropMe.board = ..."
SwarmOnline.com - Web & Mobile Development and Training Services
Check out our Ext JS 4 Cookbook
...and the FREE e-book Ext JS 4 Cookbook - Exploring Further filled with recipes that we couldn't fit in!
@StuartAshworth9
@SwarmOnline
-
3 Jun 2011 1:32 AM #3
Thanks works, but update does not work
Thanks works, but update does not work
Hi,
now I changed it like this:
But update does not work. If I change the size of Safari, it shows up.PHP Code:function fillBoard(){
this.doTheFill = function(){
var myText = new Ext.form.Text();
myText = {
style: "background-color:green;",
name: 'textName',
label:'textLabel'
}
dropMe.board.add(myText);
dropMe.board.update();
}
}
Ext.regApplication({
name: 'dropMe',
launch: function() {
dropMe.board = new Ext.Panel({
fullscreen: true,
style: "background-color:#dadee2;",
layout: "card"
});
var myBoardFiller = new fillBoard();
myBoardFiller.doTheFill();
}
})
What is wrong here?
Best TD
-
3 Jun 2011 1:34 AM #4
Replace "dropMe.board.update();" with "dropMe.board.doLayout()"
SwarmOnline.com - Web & Mobile Development and Training Services
Check out our Ext JS 4 Cookbook
...and the FREE e-book Ext JS 4 Cookbook - Exploring Further filled with recipes that we couldn't fit in!
@StuartAshworth9
@SwarmOnline
-
3 Jun 2011 1:46 AM #5
thanks again
thanks again
Great, thanks.


Reply With Quote