Results 1 to 2 of 2

Thread: ViewModel - Accessing/ Binding to Nested Stores

  1. #1
    Sencha User
    Join Date
    Jul 2016
    Posts
    15

    Default ViewModel - Accessing/ Binding to Nested Stores

    In my situation, we have a large object with several layers of nesting.
    This large object after being put into a model, is set inside 'data' of this View Model for testing.
    I am able to access several of the single objects (1 to 1), but I cannot access any of the stores within the structure.
    For example: (Faked idea)
    viewModel.set('order', order);
    viewModel.get('order.customer.address'); //works
    viewModel.get('order.items'); //returns null
    viewModel.get('order'); //cannot even see items being referenced

    The one thing that may be an issue is that the stores on the object have been modded.
    The reader to be set in the parent as camelcase + "Store". In the example above, the store for Items would be "itemsStore".
    More specifically, here is a snippet of what is in the Role constructor override (A few other custom stuff down the line...)
    Code:
        
    me.name = me.name || Ext.util.Inflector.pluralize(me.association.right.role.toLowerCase());
    name = me.name;
    Ext.applyIf(me, {
      storeName: name + "Store"
    });
    me.getterName = "get" + name.charAt(0).toUpperCase() + name.slice(1);
    Any input on how to force the stores to be accessed?
    I was hoping to be able to bind a formula to a store and pull out a specific record based on a field value.

  2. #2
    Sencha User
    Join Date
    Jul 2016
    Posts
    15

    Default

    Quote Originally Posted by REM955 View Post
    viewModel.get('order.items'); //returns null
    This is not terrible accurate to the situation. The store I want to access is another layer/ object down.
    It would be more like 'order.itemInfo.items'.

Similar Threads

  1. Setting Data and accessing it via Viewmodel - Ext JS 6 Modern
    By rabia mahmood in forum Ext JS 6.x Q&A
    Replies: 1
    Last Post: 10 Mar 2016, 1:46 PM
  2. ViewModel stores help
    By Txoov in forum Ext 5: Q&A
    Replies: 23
    Last Post: 25 Mar 2015, 9:41 PM
  3. Replies: 4
    Last Post: 14 Oct 2014, 5:07 AM
  4. Replies: 1
    Last Post: 30 Jul 2014, 2:53 PM

Tags for this Thread

Posting Permissions

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