Posted By

mongolito404 on 10/20/08


Tagged

combo extjs


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Anber


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


 / 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 " ".

  1. Ext.override(Ext.form.ComboBox, {
  2. initList: (function(){
  3. if(!this.tpl) {
  4. this.tpl = new Ext.XTemplate('<tpl for="."><div class="x-combo-list-item">{', this.displayField , ':this.blank}</div></tpl>', {
  5. blank: function(value){
  6. return value==='' ? '&nbsp' : value;
  7. }
  8. });
  9. }
  10. }).createSequence(Ext.form.ComboBox.prototype.initList)
  11. });

Report this snippet  

You need to login to post a comment.