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

Extjs combobox valueNotFoundText不生效

{
xtype: "combobox",
store: shops_store,
     queryMode: "remote",
displayField: "shop_name",
valueField: "id",
editable:false,
allowBlank: false,
emptyText:"请选择...",
valueNotFoundText:"无数据,请先添加门店",
fieldLabel: "<font color='red'>*</font>门店",
name: "staff.staffShopId",
anchor:"95%"
}

代码如上,我想实现的是shops_store里记录数为0的话,利用valueNotFoundText给出提示,可是没有出效果
------解决方案--------------------
valueNotFoundText : String
When using a name/value combo, if the value passed to setValue is not found in the store, valueNotFoundText will be displayed as the field text if defined. If this default text is used, it means there is no value set and no validation will occur on this field.


是调用setValue时触发,不是你的store为空就显示那个值
------解决方案--------------------
shops_store配置
listeners:{load:function(store){
  if(store.getCount()==0)alert('没有记录!');//或者改成你要的其他提示效果
}}