• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

ExtJS 5 View Models

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ExtJS 5 View Models

    Trying to figure out how to use the new view model's in ExtJS 5. The docs seem to be a little lacking or I am not looking at the right place.
    I understand how to use references to bind to components.
    The part that I am missing is the docs that explain how to bind the viewmodel data based on the events that place....
    for example....take a grid...i found this code on Google that shows me how to update the data in the view model when a user clicks a row

    Code:
    formulas:{
        // current customer is bound to automatically published selection
        currentCustomer:{
             bind:'{customersList.selection}'
            ,get:function(customer) {
     
                // this is core of the trick
                // whenever selection changes, this method is called
                // so we also update current.customer that is defined
                // in the main view model
                this.set('current.customer', customer);
                return customer;
     
            } // eo function get (currentCustomer)
        } // eo currentCustomer
     
    } // eo formulas
    The Key to it working is the someGridReference.selection bind parameter... But that is only for a grid selection...what about the other 1000's of events that can happen....where do i find the docs that show me all these??

  • #2
    In the example you mentioned, you are actually binding to a property named "selection" on the grid panel. Ext automatically updates this property when the grid selection is changed. The reason you can bind to it is because there is a "setter" for this property (named setSelection). Thus, you can bind to any property that has a "setter". So you could go through the documentation and look for any setters against the object you are looking to bind properties.

    Comment


    • #3
      ah...Thanks for the clarity!

      Comment

      Working...
      X