Last active
August 29, 2015 14:03
-
-
Save sunvisor/d9a04dd97c60d4c0f9ca to your computer and use it in GitHub Desktop.
Edit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}' | |
}] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
},*/ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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