Results 1 to 2 of 2

Thread: Missing ViewModel definitions in Sencha Docs example for binding association

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-15356 in 5.0.2.
  1. #1
    Sencha User
    Join Date
    Apr 2011
    Location
    Hyderabad,India
    Posts
    35

    Default Missing ViewModel definitions in Sencha Docs example for binding association

    Hi ,

    I am looking into the example of binding association as sited in sencha docs at below url http://dev.sencha.com/ext/5.0.1/exam...g-associations.

    The doc has details about the View part only and ViewModel definitions are missing. I am expecting that the missing ViewModel has the association definition, but is not yet added to the docs.

    I am not able to prepare the missing ViewModel with association details. I am expecting that this example would have 2 model definitions. 1 for Customers and the other for Orders. I am not able to prepare these 2 parts and make the connection between them.

    Can anyone help me in defining a sample ViewModel in this context.


    Thanks
    Last edited by riku351; 3 Oct 2014 at 12:14 PM. Reason: Wrong heading

  2. #2
    Sencha User
    Join Date
    May 2011
    Location
    Colorado
    Posts
    352

    Default

    The ViewModel does not have to be a separate class. In this example it is defined inline on the class body of the view:

    Code:
        viewModel: {
            stores: {
                customers: {
                    model: 'Customer',
                    autoLoad: true
                }
            }
        },
    The ViewModel defines the customers store, but does not need to define the orders store, because orders is an association store that is automatically generated by virtue of the association between customers and orders defined in the Order model.

    You are correct, though, the example is missing code preview for Customer and Order. We'll get this fixed. In the mean time you can see the code for those two models here:

    http://dev.sencha.com/ext/5.0.1/exam...el/Customer.js
    http://dev.sencha.com/ext/5.0.1/exam...model/Order.js

Posting Permissions

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