首页 > ExtJs > ExtJs comboBox 空字符处理

ExtJs comboBox 空字符处理

当extJs comboBox 中含有空元素时,显示的很小,下面的代码就是用来处理此问题的。

Ext.override(Ext.form.ComboBox, {
initList: (function(){
if(!this.tpl) {
this.tpl = new Ext.XTemplate(‘

{‘, this.displayField , ‘:this.blank}

‘, {
blank: function(value){
return value===” ? ‘&nbsp’ : value;
}
});
}
}).createSequence(Ext.form.ComboBox.prototype.initList)
});

原文:http://snipplr.com/view/9122/extjs-display-empty-string-in-extformcombobox-dropdown-list/
Be default, ExtJS does not provide any special handling to display an empty string in the dropdown list of a ComboBox. In HTML, an empty DIV element as no height. So, in the dropdown list, the “empty string” option is displayed as a thin bar, almost unselectable.

This snipped force the empty string to be rendered as ” “.

  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.