--- /dev/null
+Ext.define(
+ 'Decshee.controller.Menu',
+ {
+ extend: 'Ext.app.Controller',
+
+ views: [
+ 'menu.List',
+ 'menu.Entry'
+ ],
+
+ stores: [
+ 'menu.List'
+ ],
+
+ models: [
+ 'menu.Entry'
+ ],
+
+ init: function() {
+ console.log('[START] init');
+ this.control(
+ {
+ 'menulist': {
+ itemdblclick: this.showTab
+ }
+ }
+ );
+ console.log('[ END ] init');
+ },
+
+ showTab: function(grid, record) {
+ console.log('Double clicked on ' + record.get('caption'));
+ var caption = record.get('caption');
+ var id = record.get('id');
+
+ console.log('clicked the ShowMenu entry { text: ' + caption + ', id:' + id + '}');
+ var viewport = grid.up('viewport');
+ var maintabs = viewport.child ('#maintabs');
+ maintabs.showTab(record);
+ }
+ }
+);
\ No newline at end of file
--- /dev/null
+{
+ success: true,
+ menus: [
+ { caption: '社員情報', id: 'member'},
+ { caption: '組織情報', id: 'belonging'},
+ { caption: '権限情報', id: 'role'}
+ ]
+}
\ No newline at end of file
--- /dev/null
+{ success: true }
\ No newline at end of file
--- /dev/null
+Ext.define(
+ 'Decshee.routines.member.Edit',
+ {
+ extend: 'Ext.window.Window',
+ alias : 'widget.memberedit',
+
+ title : '社員情報詳細',
+ layout: 'fit',
+ autoShow: true,
+
+ initComponent: function() {
+ this.items = [
+ {
+ xtype: 'form',
+ items: [
+ {
+ xtype: 'textfield',
+ name : 'name',
+ fieldLabel: '氏名'
+ },
+ {
+ xtype: 'textfield',
+ name : 'email',
+ fieldLabel: 'Email'
+ }
+ ]
+ }
+ ];
+
+ this.buttons = [
+ {
+ text: '保存',
+ action: 'save',
+ handler: function(button){
+ console.log('clicked the Save button.');
+ var win = button.up('window');
+ var form = win.down('form');
+ var record = form.getRecord();
+ var values = form.getValues();
+ record.set(values);
+ win.close();
+ this.getStore().sync();
+ }
+ },
+ {
+ text: 'キャンセル',
+ scope: this,
+ handler: this.close
+ }
+ ];
+
+ this.callParent(arguments);
+ }
+ });
\ No newline at end of file
--- /dev/null
+Ext.define(
+ 'Decshee.routines.member.List',
+ {
+ extend: 'Ext.grid.Panel',
+ requires: [
+ 'Decshee.routines.member.Store',
+ 'Decshee.routines.member.Edit'
+ ],
+ alias : 'widget.memberlist',
+ title : '社員情報一覧',
+
+ store : Ext.create('Decshee.routines.member.Store'),
+ // store : 'Decshee.routines.member.Store',
+
+ initComponent: function() {
+ console.log('[START]Decshee.routines.member.List.initComponent');
+ this.columns = [
+ { header: '氏名', dataIndex: 'name', flex: 1 },
+ { header: 'Email', dataIndex: 'email', flex: 1 }
+ ];
+ this.callParent(arguments);
+ console.log('[ END ]Decshee.routines.member.List.initComponent');
+ },
+
+ listeners: {
+ itemdblclick: function(grid, record, item, index, e) {
+ console.log(record);
+ this.showForm(record);
+ }
+ },
+
+ showForm: function(record) {
+ var window = Ext.create('Decshee.routines.member.Edit');
+ window.down('form').loadRecord(record);
+ }
+ }
+);
--- /dev/null
+Ext.define(
+ 'Decshee.routines.member.Model',
+ {
+ extend: 'Ext.data.Model',
+ fields: ['name', 'email']
+ }
+);
\ No newline at end of file
--- /dev/null
+Ext.define(
+ 'Decshee.routines.member.Root',
+ {
+ extend: 'Ext.panel.Panel',
+ requires: [
+ 'Decshee.routines.member.List'
+ ],
+ alias: 'widget.memberroot',
+ layout: 'fit',
+
+ initComponent : function() {
+ console.log('[START]Decshee.routines.member.Root.initComponent');
+ var me = this;
+ Ext.apply(
+ me,
+ {
+ items: [
+ Ext.create('Decshee.routines.member.List')
+ ]
+ }
+ );
+ this.callParent(arguments);
+ console.log('[ END ]Decshee.routines.member.Root.initComponent');
+ }
+ }
+);
--- /dev/null
+Ext.define(
+ 'Decshee.routines.member.Store',
+ {
+ extend: 'Ext.data.Store',
+ requires: ['Decshee.routines.member.Model'],
+
+ model: 'Decshee.routines.member.Model',
+ autoLoad: true,
+
+ proxy: {
+ type: 'ajax',
+ api: {
+ read: 'routines/member/data.json',
+ update: 'routines/member/update.json'
+ },
+
+ reader: {
+ type: 'json',
+ root: 'members',
+ successProperty: 'success'
+ }
+ },
+
+ initComponent: function() {
+ Ext.require('Decshee.routines.member.Model');
+ }
+ }
+);
\ No newline at end of file
--- /dev/null
+{
+ success: true,
+ members: [
+ {id: 1, name: 'Ed', email: 'ed@sencha.com'},
+ {id: 2, name: 'Tommy', email: 'tommy@sencha.com'}
+ ]
+}
\ No newline at end of file
--- /dev/null
+{ success: true }
\ No newline at end of file