Home > Uncategorized > Ext.form.ComboBox dropdown trigger

Ext.form.ComboBox dropdown trigger

August 15th, 2009

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>';
  js.ib.ui.CWComboBox.superclass.initList.call(this);
},

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

Fredrik Wendt Uncategorized , ,

  1. No comments yet.
  1. No trackbacks yet.