在toolbar中配置:buttonAlign : 'center'即可,
//定义保存工具栏 var cancelRegularMeetingToolbar = new Ext.Toolbar({ buttonAlign : 'center',//这里是居中 items:[ // '->',//这里是居右 { text : "确定", iconCls : 'icon-save', handler : function() { var records = cancelRegularMeetingList.getSelectionModel().getSelections(); var saveMask = new Ext.LoadMask(Ext.getBody(), { msg: '正在保存数据,请稍后...', removeMask: true //完成后移除 }); saveMask.show(); Ext.Ajax.request({ url: "zhbg/hysgl/hysxxwhAction_cancelRegularMeetingSave.action", params: { HYSXXGLID: records[0].get("HYSXXGLID"), HYSMC: records[0].get("HYSMC"), QXR: UserInfo.userName, QXRID: UserInfo.userId, QXRQ: cancelRegularMeetingQueryPanel.getForm().findField("LHRQ").getValue(), LHMC: records[0].get("LHMC") }, method: "POST", success: function (response) { Ext.Msg.alert("信息", Ext.util.JSON.decode(response.responseText).msg); // cancelRegularMeetingQueryPanel.getForm().reset(); cancelRegularMeetingList.getStore().remove(records[0]); // cancelRegularMeetingWin.hide(); saveMask.hide(); }, failure: function (response) { Ext.Msg.alert("警告", Ext.util.JSON.decode(response.responseText).msg); } }) } },'-' , { text: "取消", iconCls: 'icon-close', handler: function () { cancelRegularMeetingQueryPanel.getForm().reset(); cancelRegularMeetingList.getStore().removeAll(); cancelRegularMeetingWin.hide(); }} ] });
如果这种方式不起作用,还有唯一一种方法就是打空格了,前面那种方法是不起作用,我用了打空格后可以居中了