1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    19
    Vote Rating
    1
    honggang.z.zhu is on a distinguished road

      0  

    Default Different controllers for different views

    Different controllers for different views


    I have two windows: 'winA' and 'winB' in sencha architect project, Both of them have a combBox with id 'cmbList'. I created two controllers 'Controller.winA' and 'Controller.winB', I want to 'Controller.winA' is for the window 'winA', 'Controller.winB' is for the window 'winB', so I added 'cmbList' onbeforerender code in 'Controller.winA'. when I showed the window 'winA', the combBox load data successfully, when I showed the 'winB', the combBox load data successfully also, but I want to load different data in the combBox on 'winB', what can I do ?

  2. #2
    Touch Premium Member BostonMerlin's Avatar
    Join Date
    Aug 2010
    Location
    Boston
    Posts
    512
    Vote Rating
    41
    BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about BostonMerlin has a spectacular aura about

      0  

    Default


    How you layout your apps controllers is obviously up to you but the general rule of thumb is to create "domain" controllers that cover areas of your app, not specific views. For example, if I have a contacts list view and a contacts editor view, I would create a Contacts controller to manage those views (not a controller for each view). If your have a dozen screens specific to "contacts" you might then consider splitting your controllers up further: ContactsMaintenance, ContactsSync, ContactsData etc..

    Lots of material out there on the topic. Hope that helps.
    John

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    19
    Vote Rating
    1
    honggang.z.zhu is on a distinguished road

      0  

    Default


    thanks for your help. But I don't know a controller how to manage a special view. I have selected a controller's views attribute, but i doesn't work. Can you give me a sample ?

Thread Participants: 1