Return to Snippet

Revision: 9059
at October 20, 2008 09:53 by mongolito404


Initial Code
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==='' ? '&nbsp' : value;
				}
			});
		}
	}).createSequence(Ext.form.ComboBox.prototype.initList)
});

Initial URL

                                

Initial Description
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 "&nbsp;".

Initial Title
[ExtJS] Display empty string in Ext.form.ComboBox dropdown list

Initial Tags

                                

Initial Language
JavaScript