记录总结

数据获取

  1. 客户端代理,从内存,本地存储获取

  2. 服务器端代理,从ajax jsonnp rest等

  3. model中schema表示表间关系的配置,可以被继承

用 sencha cmd 自动生成mvvc框架

tips

  1. chart,在extjs中默认不存在需要手动配置

  2. 写代码,先创建,后引用,代码更容易阅读

  3. 再学习阶段,先不考虑运行效率问题

extjs chart手动配置

app.json ---->requires---->添加charts //注意,添加完成后需要sencha app build

Extjs

代码如下

Ext.define('TutorialApp.view.login.Login', {
extend: 'Ext.window.Window',
xtype: 'login'
});


Now, we've defined our Login class as an extension of Ext.window.Window, which can be instantiated using the xtype login


Ext.define('TutorialApp.view.login.Login', {
extend: 'Ext.window.Window',
xtype: 'login',
requires: [
'TutorialApp.view.login.LoginController',
'Ext.form.Panel'
],
controller: 'login',
bodyPadding: 10,
title: 'Login Window',
closable: false,
autoShow: true
});

we designate controller to be login, which will be our controller's alias

类的需要

可以再代码之前运行,但必须要根据文件的路径,定义名称

extjs每个类,都需要有同名的定义,才能引入运行


Ext.define(‘User’, {
extend: ‘Ext.data.Model’,
fields: [ ‘name’, ‘email’, ‘phone’ ]

});
var userStore = Ext.create(‘Ext.data.Store’, {
model: ‘User’,
data: [
{ name: ‘Lisa’, email: ‘[email protected]’, phone: ‘555-111-1224’ },
{ name: ‘Bart’, email: ‘[email protected]’, phone: ‘555-222-1234’ },
{ name: ‘Homer’, email: ‘[email protected]’, phone: ‘555-222-1244’ },
{ name: ‘Marge’, email: ‘[email protected]’, phone: ‘555-222-1254’ } ]
});
Ext.define(‘Ext.view.panle.grid2’, {
extend:’Ext.grid.Panel’,
xtype: ‘mainlist3’,
store: userStore,
width: 400,
height: 200,
title: ‘Application Users’,
columns: [
{
text: ‘Name’,
width: 100,
sortable: false,
hideable: false,
dataIndex: ‘name’
},
{
text: ‘Email Address’,
width: 150,
dataIndex: ‘email’,
hidden: true
},
{
text: ‘Phone Number’,
flex: 1,
dataIndex: ‘phone’
}
]
});

这个文档写在app/view/panle/grid2.js,所以必须有一个define定义Ext.define(‘Ext.view.panle.grid2’, {})

你可能感兴趣的:(记录总结)