直接给JSON串:


var products = [
            {productid:'FI-SW-01',name:'Koi'},
            {productid:'K9-DL-01',name:'Dalmation'},
            {productid:'RP-SN-01',name:'Rattlesnake'},
            {productid:'RP-LI-02',name:'Iguana'},
            {productid:'FL-DSH-01',name:'Manx'},
            {productid:'FL-DLH-02',name:'Persian'},
            {productid:'AV-CB-01',name:'Amazon Parrot'}
        ];

{
  field: 'Ptype',
  title: '类别', 
  width: 200,
  editor:{
    type:'combobox',
    options:{
      valueField:'productid',
      textField:'name',
      data:products,
      required:true
         }
     }
}


感谢CSDN用户showbo提供答案


使用查询数据给值:



codeClass.editor = {
		type : 'combobox',
		options : {
			valueField : 'generalCode',
			textField : 'categoryName',
			method : 'post',
			url : '/bfs/bfs/configuration/categoryclassbysystemtype?systemType='+systemType,
			required : true,
			editable:true,
  			onLoadSuccess : function(data) {
  				if(data && data.length>0){
  					$(this).combobox('select',data[0].generalCode);
  				}
  				
  			},
		}
	};




欢迎留言