调试了很久,终于出来了。
- Ext.define('MyApp.views.lifechannelCombo', {
- extend: 'Ext.form.field.ComboBox',
- alias:'widget.lifechannelCombo',
- id:'lifechannelCombo',
- name:'channelname',
- value:'channelid',
- width: 180,
- fieldLabel: '推送渠道',
- labelWidth: 60,
- emptyText: '请选择',
- queryMode:'local', //这个需要加上。。
- store: new Ext.data.Store({
- singleton : true,
- proxy: {
- type: 'ajax',
- url : 'lifechannel!queryChannelid',
- actionMethods : 'post',
- reader: {
- type: 'json',
- totalProperty: 'ChannelCount',
- root: 'root'
- }
- },
- fields:['channelid', 'channelname'], //不管有没有model,这个fields都必须写,而且只能写在这里,
- //在reader里面的话会报错"reader.read is not a function"
//原因暂时不详
- autoLoad:true
- }),
- loadingText:'正在加载数据,请稍侯……',
- triggerAction:'all',
- valueField:'channelid',
- displayField:'channelname',
- initComponent: function() {
- var me = this;
- me.callParent(arguments);
- }
- });