ExtJS 4 MVC multiple instances of views and sub/child controller difficulties

前端 未结 7 1034
情书的邮戳
情书的邮戳 2021-02-07 13:01

I have encountered a problem with the MVC pattern in ExtJS 4. At least, I think I have. Having approached multiple people with this question, and having posted numerous times in

相关标签:
7条回答
  • 2021-02-07 14:01

    How do you create your views? I see no reason why you cannot pass a different store or config data to every object. Some code samples would help for what exactly you are doing. For example, we have a similar sounding application, and everything is done with extensions. So, if we need a grid, we run

    Ext.define('MyApp.grids.something',{
    extends:'Ext.grid.panel' 
    //...
    

    These classes are predefined. Then, when a controller or view is loading this grid, they are using

    var grid=Ext.create('MyApp.grids.something',{id:'unique',store:mystore});
    

    As you can see, we can pass in different config options to the same grid each time it is created. We can treat this exactly as you would treat

    Ext.create('Ext.grid.Panel');
    

    Except of course that we make some options predefined, and some non-override-able, and so on.

    Hope this helped.

    0 讨论(0)
提交回复
热议问题