一、图表保存成图片自动下载
tbar: [{ text: 'Save Chart', handler: function() { Ext.MessageBox.confirm('Confirm Download', 'Would you like to download the chart as an image?', function(choice){ if(choice == 'yes'){ chart.save({ type: 'image/png' }); } }); } }]二、点击gridpanel动态更新panel的内容
1.新建一个Ext.Template,例如:
var bookTplMarkup = [
'Title: <a href="{DetailPageURL}" target="_blank">{Title}</a><br/>',
'Author: {Author}<br/>',
'Manufacturer: {Manufacturer}<br/>',
'Product Group: {ProductGroup}<br/>'
];
var bookTpl = Ext.create('Ext.Template', bookTplMarkup);
2.grid代表点击的gridpanel,detailPanel为要更新内容的panel,绑定事件,
grid.getSelectionModel( ).on('selectionchange',function(me,selectionrecord){
if(selectionrecord.length){
var detailPanel=Ext.getCmp('detailPanel');
bookTpl.overwrite(detailPanel.body,selectionrecord[0].data)
}
})
三、常用代码段Ext.Ajax.Request
Ext.Ajax.request({
url : 'question/question/audit',
method : 'POST',
params : {
'questionId':modelArray[0].raw.questionId,
'result':btn.action
},
success : function(rec, opt) {
Ext.Msg.alert('信息提示','审核成功!!');
Ext.ComponentQuery.query('qualifiedview #questionlist')[0].getStore().load();
win.close();
//win.down('#ckeditor').setValue(obj.datas[0].content);
},
failure : function(e, op) {
Ext.Msg.alert("发生错误", op.error);
}
});
Form.Submit
form.submit({
url : $baseUrl + '/number/number/import',
waitMsg : '正在上传处理过程中...',
success : function(form, action) {
var ii = '';
if (action.result.msg == '上传成功') {
ii = action.result.msg;
} else {
ii = action.result.msg;
}
win.close();
var store = Ext.ComponentQuery.query('#numberlist')[0].getStore();
var proxy = store.getProxy();
proxy.extraParams = '';
store.load();
Ext.Msg.alert('操作提示', ii);
},
failure : function(form, action) {
win.close();
Ext.Msg.alert('操作提示', action.result.msg);
}
});
store setExtraParam
store.getProxy().setExtraParam('status', status);
固定store的combobox
1、 var locationStore = Ext.create('Ext.data.Store', {
fields : ['value', 'text'],
data : {
'items' : [{
value : 1,
text : '导航条下方'
}, {
value : 2,
text : '招聘信息上方'
}, {
value : 3,
text : '求职信息上方'
}, {
value : 4,
text : '求职信息下方'
}]
},
proxy : {
type : 'memory',
reader : {
type : 'json',
root : 'items'
}
}
});
2、
{
xtype : 'combobox',
name : 'location',
fieldLabel : '显示位置',
store : locationStore,
displayField : 'text',
valueField : 'value',
editable : false
}