日期:2014-05-16  浏览次数:20351 次

extjs Ext.form.ComboBox问题
//extjs3.3 
问题:1,不加hiddenName时值传递不到后到
  2,加hiddenName时值要吧传递到后台,但在IE7下下拉框位置错了 ---这是什么原因呀?

{

  xtype: "compositefield",
  fieldLabel: "产品类型",
  items: [{  
  id: "product_type_id",  
  maxHeight: 200,
  width: 127,
  xtype: "combo",
  mode: "local",
  editable: false,
  triggerAction: "all",
  //hiddenName:"product_type_id",
  allowBlank : false, //是否允许为空
  store: new Ext.data.JsonStore({
  autoLoad: true,
  url: "../admin/get_product.php?act=qt",
  fields: ["product_type_id","product_type_name"],
  root:'data'
  }),
  displayField: "product_type_name",//下拉显示字段
  valueField: "product_type_id", //传送的值
  // hiddenName: "product_type_id",
  name:"product_type_id",
  value:''
  }]
}

------解决方案--------------------
应该是布局的问题吧,帮顶。
------解决方案--------------------
{
xtype:'combo',
store: new Ext.data.SimpleStore({
fields: ["retrunValue", "displayText"],
data: data_str
}),

valueField :"retrunValue",
displayField:"displayText",
mode:'local',
editable: false,
forceSelection: true,
triggerAction: 'all',
hiddenName:'"product_type_id',
fieldLabel:'产品类 型',
emptyText:'选择',
name :'"product_type_id',
id : '"product_type_id',
value:'',
anchor:'90%'
}

另外 data_str 用ajax 请求 尝试下 我用的就是这样的方法
------解决方案--------------------
hiddenName就相当于name的另一个名字,
并且hiddenName必须与valueField一样才能往后台传递valueField所对应的值
显示有问题可能与布局有关!
------解决方案--------------------
JScript code

 var txtPoliceStation = new Ext.form.ComboBox({
                    fieldLabel: '<font color="red">*</font>所属单位',
                        store: psStores,
                        name: 'PoliceStationId',
                        hiddenName: 'PoliceStationId',
                        valueField: 'Id',
                        displayField: 'PoliceStatName',
                        typeAhead: true,
                        mode: 'remote',
                        triggerAction: 'all',
                        emptyText: '---请选择单位---',
                        selectOnFocus: true,
                        allowBlank: false,  
                        width: 200
                    });