grid不现实列名
Ext.define('Logistics.view.financialManagement.vehicleWearAndTearStandard.VehicleWearAndTearStandardGrid', { extend: 'Ext.grid.Panel', config: { frame: true, bodyBorder: true, margin: 6, autoScroll: true, autoShow: true, border: true, layout: "fit", align:'right', columns: [{ xtype: 'rownumberer' }, { text: '司机提成系数', dataIndex: 'TireRepairSubsidiesCoefficient', flex: 1 }, { text: '安全奖金系数', flex: 1, dataIndex: 'MaintenanceCostsCoefficient' } , { text: '安全奖金系数', flex: 1, dataIndex: 'TireWearCoefficient' } , { text: '安全奖金系数', flex: 1, dataIndex: 'RoadAndBridgeCostsCoefficient' } , { text: '安全奖金系数', flex: 1, dataIndex: 'BusinessTaxRate' } , { xtype: 'datecolumn', text: '启用日期', flex: 1, dataIndex: 'StartDate', renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { xtype: 'datecolumn', text: '终止日期', flex: 1, dataIndex: 'EndDate', renderer: Ext.util.Format.dateRenderer('Y-m-d') }, { text: 'ID', dataIndex: 'ID', hidden: true }] }, initComponent: function () { var addAction = Ext.create('Ext.Action', { text: '新增', iconCls: 'x-add', scope: this, handler: this.onAddActionHandler }); var editAction = Ext.create('Ext.Action', { text: '修改', iconCls: 'x-pencil', scope: this, handler: this.onEditActionHandler }); var deleteAction = Ext.create('Ext.Action', { text: '删除', iconCls: 'x-delete', scope: this, handler: this.onDeleteActionHandler }); var toolbar = [addAction, editAction, '-', deleteAction]; var contextmenu = Ext.create('Ext.menu.Menu', { margin: '0 0 10 0', items: [editAction, '-', deleteAction] }); //调用右键菜单 var listeners = { show: function (grid, opts) { grid.store.load(); }, itemcontextmenu: function (view, record, item, index, event, options) { event.preventDefault(); contextmenu.showAt(event.getXY()); } }; var store = Ext.create('Logistics.store.financialManagement.VehicleWearAndTearStandard'); store.load(); Ext.apply(this, { store: store, tbar: toolbar, listeners: listeners }); this.callParent(arguments); }, onAddActionHandler: function () { var grid = this; var url = '/FinancialManagement/VehicleWearAndTearStandard/New'; Ext.Ajax.request({ url: url, success: function (response) { var result = Ext.decode(response.responseText); if (result.success) { if (!grid.addDialog) grid.addDialog = Ext.create('Logistics.view.financialManagement.vehicleWearAndTearStandard.InputDialog', { title: '新增', width: 300, height: 180, url: url, reload: function () { grid.reload(); } }); grid.addDialog.reset(); grid.addDialog.show(); } else { Ext.Msg.alert('温馨提示', result.Message); } } }); }, onEditActionHandler: function () { var selection = this.getSelectionModel().getSelection(); if (selection.length == 0) { Ext.Msg.alert('温馨提示', '请选择修改项!'); return; } id = selection[0].data.ID; var grid = this; //var url = '/FinancialManagement/DriverRewardStandard/Edit/' + id; Ext.Ajax.request({ url: '/FinancialManagement/VehicleWearAndTearStandard/Edit/', method: 'GET', params: { id: id }, success: function (response) { var result = Ext.decode(response.responseText); if (result.success) { if (!grid.editDialog) { grid.editDialog = Ext.create('Logistics.view.financialManagement.vehicleWearAndTearStandard.InputDialog', { title: '修改', width: 300, height: 180, url: '/FinancialManagement/VehicleWearAndTearStandard/Edit', reload: function () { grid.reload(); } }); var entity = result.Data; entity.StartDate = new Date(entity.StartDate); entity.EndDate = new Date(entity.EndDate); grid.editDialog.reset(); grid.editDialog.setValues(entity); grid.editDialog.show(); grid.editDialog = false; } } else { Ext.Msg.alert('温馨提示', result.Message); } } }); }, onDeleteActionHandler: function () { var selection = this.getSelectionModel().getSelection(); var store = this.getStore(); if (selection.length == 0) { Ext.Msg.alert('温馨提示', '请选择修改项!'); return; } else { Ext.Msg.confirm('温馨提示', '是否确认删除该项?', function (btn) { if (btn == 'yes') { id = selection[0].data.ID; Ext.Ajax.request({ url: '/FinancialManagement/VehicleWearAndTearStandard/Delete', params: { id: id }, success: function (response) { var result = Ext.decode(response.responseText); Ext.Msg.alert('温馨提示', result.Message); if (result.success) { store.reload(); } } }); } else { return; } }); } }, reload: function () { this.getStore().reload(); } });
求大侠帮忙
部分原因是ID和rownumberer不能放在一起
ID列可以不要