Weitere ähnliche Inhalte
Ähnlich wie Ext.direct (20)
Ext.direct
- 7. ウリはたくさん
● Sencha Touch - スマフォ向けRIAアプリ対応
● Sencha Architect - ビジュアルエディタ
● Sencha Cmd - ビルドコマンド
and more...
今回はこのへん触れません。m(_ _)m
イチ押し ⇒ Ext.DirectとMVCアーキテクチャ
- 17. その3
モデル準備
model/Member.js (テーブルに利用するデータ定義)
Ext.define('MyApp.model.Member', {
extend : 'Ext.data.Model',
fields :[
{name: 'section' , type: 'string'},
{name: 'name' , type: 'string'},
{name: 'offence' , type: 'int'},
{name: 'defence' , type: 'int'},
{name: 'speed' , type: 'int'},
{name: 'condition' , type: 'string'},
{name: 'birth' , type: 'timestamp'},
{name: 'weapon' , type: 'string'}
]
});
- 18. その3
データストア準備
store/Members.js (ストア=テーブルデータのコントローラ)
Ext.define('MyApp.store.Members', {
extend : 'Ext.data.Store',
model : 'MyApp.model.Member',
proxy : {
type : 'direct',
api : {
create : Members.add, // 1のサーバメソッドを指定
read : Members.getAll,
...
},
reader : {
type : 'json'
...
}
- 23. さらに one more thing
Ext.Directがわかりにくい
サーバメソッドを呼び出す動きが見たい。
というわけで、Footer部に簡単なサーバクラス呼び出し用のボタ
ンを追加。(ほんとはビューでコントロールしちゃダメ(^_^;))
view/Footer.js --> view/EchoBox.js
}, {
xtype : 'button',
text : 'Server Info',
handler : function(btn) {
EchoClass.who(function(text) {
alert(text);
});
}
}]
- 25. o... one more thing (^_^;)
Proxyモデル
● ExtJS(Sencha)はデータのProxyモデルが整備されている。
● テーブルのような配列型データ構造は以下の構成をとる。
Memory?
Proxy
File?
Table Server?
View Store
データ
バインディング Reader/
Writer
⇒ LocalStrage使ってみると、クライアントのみのアプリに切り替わる