ExtJS Model Store study notes

Source: Internet
Author: User

Http://docs.sencha.com/extjs/6.2.0/guides/core_concepts/data_package.html

Define a model
Ext.define (' MyApp.model.User ', { ' Ext.data.Model ', fields : [ ' name ', type: ' String '}, ' age ', type: ' int '} ]});

Define a store
Ext.define (' MyApp.store.Users ', { ' Ext.data.Store ', ' store.users ', ' MyApp.model.User ', data: [//Stores can also load data in-line. Internally, Store converts each of the objects we pass in as data into records of the appropriate Model type: ' Se Th ', Age: ' I '}, ' Scott ', Age: 'a ', ' Gary ', Age: ' + ', ' capybara ', Age: ' 208 '} });

varstore = ext.create (' Ext.data.ArrayStore ', {    //Store ConfigsStoreId: ' Mystore ',    //Reader ConfigsFields: [//Fields can be defined directly without the need to define model' Company ', {name:' Price ', type: ' Float '}, {name:' Change ', type: ' Float '}, {name:' Pctchange ', type: ' Float '}, {name:' Lastchange ', type: ' Date ', DateFormat: ' n/j h:ia '}], data= [        [' 3m Co ', 71.72,0.02,0.03, ' 9/1 12:00am '],        [' Alcoa Inc ', 29.01,0.42,1.47, ' 9/1 12:00am '],        [' Boeing Co. ', 75.43,0.53,0.71, ' 9/1 12:00am '],        [' Hewlett-Packard Co. ', 36.53,-0.03,-0.08, ' 9/1 12:00am '],        [' Wal-mart Stores, Inc. ', 45.45,0.73,1.63, ' 9/1 12:00am ']    ]    });

 
Model中定义的Proxy是针对该model的CURD进行的操作。是针对单条记录的。也就是可以建立一个model的对象,通过proxy提交到后台
Store中定义的Proxy是针对model集合的查询操作。

Models are typically used with a Store, which is basically a collection of records (instances of a Model-derived class)


ExtJS Model Store study notes

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.