Ext.form.ComboBox dropdown trigger

The Ext.form.ComboBox is almost testing friendly. Not everyone can do what we did, but we could and it made testing sooo much easier (and human readable).

onRender: function(ct, position) {
  Ext.form.TriggerField.superclass.onRender.call(this, ct, position);
  this.wrap = this.el.wrap({cls: "x-form-field-wrap"});
  this.trigger = this.wrap.createChild(this.triggerConfig ||
    {id: this.id + '_trigger', tag: "img", src: Ext.BLANK_IMAGE_URL,
    cls: "x-form-trigger " + this.triggerClass});
  // rest is as in original

And also

initList: function() {
  var cls = 'x-combo-list';
  this.tpl = '<tpl for="."><div class="' + cls + '-item" id="' + this.id +
    '_{' + this.valueField + '}">{' + this.displayField + '}</div></tpl>';

An alternative is to use CSS selectors, as described by CableDawg on ExtJS’ forum.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>