/ Published in: JavaScript
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 " ".
This snipped force the empty string to be *rendered* as " ".
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Ext.override(Ext.form.ComboBox, { initList: (function(){ if(!this.tpl) { this.tpl = new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">{', this.displayField , ':this.blank}</div></tpl>', { blank: function(value){ return value==='' ? ' ' : value; } }); } }).createSequence(Ext.form.ComboBox.prototype.initList) });