pricey
19 Aug 2011, 6:13 AM
Hello all, I am newbie to Ext JS, unfortunately my foray into Ext JS had to be into the recent MVC - Though I am not at all new to MVC, I find it hard to grasp Ext JS's own way of MVC implementation! (as others in the forum are complaining... but that is a discussion for another time)
Anyway, after going through all the very scarce MVC examples and unclear documentation .... wasting so many man hours, still I am not clear how to go about things here.
My first example is simple and as starting point to using ExtJS further along, but it is taking such a strain to code it in 4!
I have 2 views, both forms. First one has a button which when clicked must open the second view. I put the following code in controller, but nothing seems to be working, Can someone please help me how to do add view on button click in new MVC way? or can't you add views liek that from controller? Am i missign something here?
init: function(){
this.control({
'view1 button[action=toView2]': {
click: this.toView2
});
},
/*Did not work*/
toView2: function(button) {
var toView2= this.getView2(). show();
/*Did not work either. First view gets removed, but second view is not loaded*/
var form1 = this.getView1();
form1.removeAll();
var form2 = Ext.create('EX.view.Form2');
form1.add(form2);
Anyway, after going through all the very scarce MVC examples and unclear documentation .... wasting so many man hours, still I am not clear how to go about things here.
My first example is simple and as starting point to using ExtJS further along, but it is taking such a strain to code it in 4!
I have 2 views, both forms. First one has a button which when clicked must open the second view. I put the following code in controller, but nothing seems to be working, Can someone please help me how to do add view on button click in new MVC way? or can't you add views liek that from controller? Am i missign something here?
init: function(){
this.control({
'view1 button[action=toView2]': {
click: this.toView2
});
},
/*Did not work*/
toView2: function(button) {
var toView2= this.getView2(). show();
/*Did not work either. First view gets removed, but second view is not loaded*/
var form1 = this.getView1();
form1.removeAll();
var form2 = Ext.create('EX.view.Form2');
form1.add(form2);