var milestoneListProxy = new Ext.data.HttpProxy( { method :"POST", url : 'data.jsp' });
var milestoneListReader = new Ext.data.JsonReader({
fields : [ 'projectId', 'milestoneId', 'milestoneName', 'date', 'sectionId', 'sectionName', 'planTotalCost', 'planCompleteCost', 'planCompleteRate', 'realityCompleteCost', 'realityCompleteRate' ], root : 'root' });
var milestoneListStore = new Ext.data.GroupingStore({ proxy :milestoneListProxy, reader :milestoneListReader, sortInfo:{field: 'projectId', direction: "ASC"}, groupField:'milestoneName' // ① });
// ② var milestoneListColumns = [ new Ext.grid.RowNumberer(), { header :"マイルストーン", dataIndex :'milestoneName' }, { header :"日付", dataIndex :'date' }, { header :"作業名", dataIndex :'sectionName' }, { header :"計画完成工数", dataIndex :'planCompleteCost' }, { header :"実際完成工数", dataIndex :'realityCompleteCost' }, { header :"実際達成度", dataIndex :'realityCompleteRate' } ];
var onAdd = function() { milestonePanel.show(); Ext.getCmp('date').setValue(''); Ext.getCmp('milestoneName').setValue(''); Ext.getCmp('description').setValue(''); milestoneForm.isAdd = true; };
var onDelete = function() { var rec = milestoneListGrid.getSelectionModel().getSelected(); if (!rec) { Ext.MessageBox.alert('警告', '選択してください。'); return false; } Ext.Msg.show({ title:'確認', msg: '削除確認?', buttons: Ext.Msg.YESNOCANCEL, // fn: function() {alert();},
icon: Ext.MessageBox.QUESTION }); };
var milestoneListGrid = new Ext.grid.GridPanel( { restful : true, iconCls :'icon-grid', frame :true, autoScroll :true, autoHeight :true, animCollapse: false, sm :new Ext.grid.RowSelectionModel( { singleSelect :true }), store :milestoneListStore, columns :milestoneListColumns, loadMask : { msg :'Loading.....' }, bbar :new Ext.PagingToolbar( { // id :'milestoneListBbar',
pageSize :10, store :milestoneListStore, displayInfo :true }), tbar : [ { text :'追加', handler : onAdd }, '-', { text :'削除', handler : onDelete }],
view: new Ext.grid.GroupingView({ forceFit:true, groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})' }),
listeners : { 'rowdblclick' : function() { milestonePanel.show(); var rec = milestoneListGrid.getSelectionModel().getSelected(); Ext.getCmp('date').setValue(rec.get('date')); Ext.getCmp('milestoneName').setValue(rec.get('milestoneName')); Ext.getCmp('description').setValue(rec.get('milestoneName')); milestoneForm.isAdd = false; } } });
|