Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Edit.js
Ext.define("MyApp.view.edit.Edit",{
extend: "Ext.form.Panel",
xtype: 'myedit',
viewModel: {
type: "edit-edit"
},
bodyPadding: 10,
items: [{
xtype: 'textfield',
fieldLabel: 'ID',
bind: '{rec.id}'
}, {
xtype: 'textfield',
fieldLabel: '名前',
bind: '{rec.name}'
}, {
xtype: 'textfield',
fieldLabel: 'メール',
bind: '{rec.email}'
}]
});
Ext.define("MyApp.view.list.List",{
extend: "Ext.grid.Panel",
xtype: 'mylist',
controller: "list-list",
viewModel: {
type: "list-list"
},
bind: '{users}',
columns: [{
dataIndex: 'id',
text: 'ID'
},{
dataIndex: 'name',
text: '名前',
width: 300
},{
dataIndex: 'email',
text: 'メール',
width: 300
}],
listeners: {
itemdblclick: {
fn: 'onSelectItem',
scope: 'controller'
}
},
bbar: [{
xtype :'pagingtoolbar',
bind: {
store: '{users}'
}
}]
/*initComponent: function() {
var me = this,
store = me.getViewModel().getStores('users');
console.log(store);
Ext.applyIf(me, {
bbar: [{
xtype :'pagingtoolbar',
store: me.getViewModel().getStores('users')
}]
});
me.callParent(arguments);
},*/
});
Ext.define('MyApp.view.list.ListModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.list-list',
requires: [
'Ext5.model.User'
],
stores: {
users: {
model: 'Ext5.model.User',
data: [{
id:1, name: '中村', email: 'nakamura@examplecom'
},{
id:2, name: '山田', email: 'yamada@examplecom'
},{
id:3, name: '田中', email: 'tanaka@examplecom'
},{
id:4, name: '佐藤', email: 'sato@examplecom'
},{
id:5, name: '齋藤', email: 'saito@examplecom'
}],
proxy: {
type: 'memory'
},
autoLoad: true
}
},
data: {
name: 'Ext5'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment