ExtJS4Beta2 preview: Ext. Brew package

Source: Internet
Author: User
& Nbsp; we have not introduced the new Ext. Brew package, one of the many features of ExtJS4. This is a unique Javascript framework. Ext. Brew is a perfect cup of tea made using the unique Sencha technology. & Nbsp; Use the powerful functions of the new data packet to build a consistent and balanced tea S at any time

We have not introduced the new Ext. Brew package, one of ExtJS 4's many features. This is a unique Javascript framework. Ext. Brew is a perfect cup of tea made using the unique Sencha technology.

With the power of new data packets, you can build a tea application that generates consistent and balanced data at any time. Before starting, define a model for interaction between components.

1 Ext. onReady (function (){
2 Ext. regModel (Cups ,{
3 fields: [material, size]
4 });
5
6 Ext. regModel (Teas ,{
7 fields: [name, caffeine, brewtemp]
8 });
9
10 var cupStore = new Ext. data. Store ({
11 model: Cups,
12 sorters: [size],
13 data :[
14 {material: Ceramic, size: 6 oz },
15 {material: Ceramic, size: 12 oz },
16 {material: Glass, size: 8 oz },
17 {material: Glass, size: 16 oz}
18]
19 });
20
21 var teaStore = new Ext. data. Store ({
22 model: Teas,
23 sorters: [name],
24 data :[
25 {name: Sencha, caffeine: 45, brewtemp: 175 },
26 {name: Earl Grey, caffeine: 40, brewtemp: 210 },
27 {name: Oolong, caffeine: 70, brewtemp: 176 },
28 {name: Herbal, caffeine: 0, brewtemp: 210}
29]
30 });
31 });

 
 
 
Now we have a model and Store for tea. Unfortunately, only Sencha tea can be made in the new Brew package of Beta 2. If you want to try other teas, hot water may pop up from your notebook. Therefore, exercise caution when using the beta software.

To use the Ext. Brew package, you must extend it from the base class and provide the Store so that it can know the type of tea and how to operate it. You can start, pause, or stop an instance. When Brew is active, you can check the status and temporary attributes to provide users with an Extjs application with a good user experience. The onready event is called when brew is complete based on model variables. However, when the state value is "active", do not pause or stop brew. This function has not been fully tested and may lead to weak brew.

1 Ext. define (MyApp. BrewMaster ,{
2 extend: Ext. Brew,
3
4 cups: cupStore,
5 teas: teaStore,
6
7 sugar: medium,
8 milk: skim,
9
10 initComponent: function (){
11 // run your brew management code here such
12 // checking brewtemp before the brew starts
13
14 MyApp. BrewMaster. superclass. initComponent. apply (this, arguments );
15}
16
17 onReady: function (){
18 if (this. brewtemp & gt; 100 ){
19

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.