[ExtJS5 Study notes] section 16th EXTJS5 using the panel's new ViewModel property binding data

Source: Internet
Author: User

This address: http://blog.csdn.net/sushengmiyan/article/details/39078627

Sencha official Api:http://docs.sencha.com/extjs/5.0/apidocs/#!/api/ext.panel.panel-cfg-viewmodel

This article Sushengmiyan

--------------------------------------------------------------------------------------------------------------- ---------------------


Sencha Ext JS 5 version of the concept is not viewmodel, now that EXTJS5 support for the MVVM mode, then her components will correspondingly increase the default support for MVVM. Now look at the strong support for the MVVM pattern of the panel component that we often use.

First look at the definition of the document's ViewModel property for the panel:

Viewmodel:string/object/ext.app.viewmodelthe ViewModel is a data provider for this component and its children. The data contained in the ViewModel are typically used by adding bind configs to the components that want present or edit T His data. When set, the ViewModel are created and links to any inherited ViewModel instance from an ancestor container as the "parent ". The ViewModel hierarchy, once established, only supports creation or destruction of children. The parent of a ViewModel cannot is changed on the fly. If This is a root-level ViewModel, the data model connection was made to this component ' s associated data Session. This was determined by calling Getinheritedsession.defaults to: {$value: null, lazy:true}
Translate the above information into the following:

ViewModel: The property can be set to a string or object or Ext.app.ViewModel

ViewModel is the data provider for this component and sub-component, and the data contained in ViewModel is typically used to increase the BIND configuration to the component that wants to render or edit the data.

When set up, ViewModel creates and connects to any parent component on the inheritance hierarchy, and once created, the parent component cannot change the child artifacts.

If the root viewmodel,datamodel is associated to the data node, this is determined by getting the inheritance node.

Default: {$value: null, lazy:true}


To put it simply, when you want to get data from another model in Panle, you need to make a viewmodel, which allows you to get data from ViewModel.


[ExtJS5 Study notes] section 16th EXTJS5 using the panel's new ViewModel property binding data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.