Results 1 to 4 of 4

Thread: MVC, how to render view from controller?

  1. #1
    Sencha User netresource's Avatar
    Join Date
    Oct 2011
    Posts
    23
    Vote Rating
    0
      0  

    Default MVC, how to render view from controller?

    I have two controllers: Homes and Users
    Homes controller with HomePage view and Users controller with LoginForm view
    I want to call LoginForm view from a login button on HomePage view.
    How can do it with ST 2.x MVC?

  2. #2
    Sencha Premium Member
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default

    Add on button click event the login view to your desired panel (By xtype, see alias within a view)

    See:
    http://docs.sencha.com/touch/2-0/#!/...method-control
    Last edited by emielvangoor; 1 Nov 2011 at 1:28 AM. Reason: Added the link to Extjs4 API by mistake...

  3. #3
    Sencha User netresource's Avatar
    Join Date
    Oct 2011
    Posts
    23
    Vote Rating
    0
      0  

    Default

    in 1.x i can do it with
    on HomePage view
    PHP Code:
        onLoginAction: function () {
            
    Ext.dispatch({ 
               
    controller'Users'
               
    action'loginForm'
            
    });

    in User controller
    PHP Code:
    loginForm: function () {

     if ( ! 
    App.views.loginForm){
    App.views.loginForm this.render({xtype'App.views.LoginForm',});}
    var 
    model = new  App.models.User();
    App.views.loginForm.load(model);
    App.views.viewport.setActiveItem(App.views.loginForm, { type'slide'direction'left' }); 


    but i can't do like this with 2.x

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default

    I don't have much experience with Touch (1 or 2) but Ext.dispatch doesn't exists anymore in Touch 2, maybe http://docs.sencha.com/touch/2-0/#!/...-getController will help you to get the controller...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •