Results 1 to 4 of 4

Thread: ViewModel - chain viewmodel store to global store.

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    151
    Answers
    3

    Default Answered: ViewModel - chain viewmodel store to global store.

    Hi All,

    I have a rather large store that reads from local storage, rather than have 3 copies of most of the data I'd like to load one main global store and then in viewmodels for various screens provide a chained store that would filter to some subset of the data.

    Is this possible?

    Or do I need to provide a master viewModel with the main global store and then chain from there? (the only way this works is if all the screens are children of the view where the main viewModel is defined so it's not optimal for popup screens attached directly to the viewport).

    Thanks
    Bob

  2. Hi--

    If I'm understanding correctly what you're after, it should definitely be possible:

    https://fiddle.sencha.com/#fiddle/14r6

    Thanks!
    Joel

  3. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    If I'm understanding correctly what you're after, it should definitely be possible:

    https://fiddle.sencha.com/#fiddle/14r6

    Thanks!
    Joel

  4. #3
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    151
    Answers
    3

    Default

    Thanks,

    I hadn't seen the type attribute of the source config.

    That works perfect.
    Bob

  5. #4
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,295
    Answers
    16

    Default

    The fiddle that was provided create many instances of MainStore, to have only one instance you must ask to use the existing store, using 'storeId', see https://fiddle.sencha.com/#fiddle/1grh

Similar Threads

  1. Replies: 3
    Last Post: 28 Nov 2016, 2:00 PM
  2. Replies: 2
    Last Post: 20 Feb 2015, 3:05 AM
  3. [INFOREQ] ChainedStore in ViewModel with global store as source
    By andreas-spindler in forum Ext 5: Bugs
    Replies: 3
    Last Post: 17 Sep 2014, 10:47 PM
  4. Replies: 2
    Last Post: 24 Jul 2014, 1:50 AM

Posting Permissions

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