1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Posts
    17
    Vote Rating
    1
    martio is on a distinguished road

      0  

    Question Unanswered: [EXTJS4.1][MVC] How to reuse a component?

    Unanswered: [EXTJS4.1][MVC] How to reuse a component?


    Hi,


    How to reuse a component MVC? Each component should have its own instance of store. Now I create two instances of component (controller, view, store). How to filter data in first component? Only first, without affecting data in second component.


    Regards,
    Marcin

  2. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Vote Rating
    0
    purnima_iyer is on a distinguished road

      0  

    Default


    I am facing the same problem how can i reuse to same store for different components

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2011
    Posts
    28
    Answers
    1
    Vote Rating
    2
    shmeltex is on a distinguished road

      0  

    Default


    Quote Originally Posted by purnima_iyer View Post
    I am facing the same problem how can i reuse to same store for different components
    To reuse the same store with multiple components just refer to it by name like this:
    Assuming you have store Sample defined
    Code:
    Ext.define('XX.store.Sample', {...});
    You can refer to it in view(s):
    Code:
    Ext.define('XX.view.PanelX',
      {
        ....
        initComponent: function(){
         this.items = [
           {
               xtype: 'combo',
               itemId: 'comboOne',
               .....
               store: 'Sample'
           },
           {
              xtype: 'grid',
              itemId: 'comboTwo',
              ....
              store: 'Sample'
            }
        ]
       }
      }
    Keep in mind though that both combobox and grid share the same instance of store, so all filtering/sorting/changes to it will be automatically propagated to both.

  4. #4
    Ext JS Premium Member
    Join Date
    Feb 2011
    Posts
    28
    Answers
    1
    Vote Rating
    2
    shmeltex is on a distinguished road

      0  

    Default


    Quote Originally Posted by martio View Post
    Hi,


    How to reuse a component MVC? Each component should have its own instance of store. Now I create two instances of component (controller, view, store). How to filter data in first component? Only first, without affecting data in second component.


    Regards,
    Marcin
    You can use Ext.create to create as many instances as you need, for example:
    Code:
    Ext.define('XX.store.Sample', {....});
    storeA = Ext.create('XX.store.Sample', {storeId: 'A'});
    storeB = Ext.create('XX.store.Sample', {storeId: 'B'});

  5. #5
    Sencha User
    Join Date
    Aug 2012
    Posts
    2
    Vote Rating
    0
    purnima_iyer is on a distinguished road

      0  

    Default


    Thank you for your reply.I tried to create to instances of the store ,this helps in applying different filtering/sorting/changes to each store

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar