Results 1 to 4 of 4

Thread: ComboBox custom template - how do I attach a click handler

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Dec 2011
    Vote Rating

    Default Answered: ComboBox custom template - how do I attach a click handler

    I have constructed a ComboBox with a custom Template. Inside this template I have anchor links for which I need to handle the 'click' event. I don't know if this is the best way to implement such functionality, so if there is a better way I am all ears.
    Last edited by jmartinez40; 2 Dec 2011 at 9:12 AM. Reason: Code was missing

  2. You should be able to specify listeners in the listConfig of the combobox. They will then apply to the drop-down.

    I think you've misunderstood Mitchell's example. He's using event delegation. That involves attaching a single listener to the whole list. The delegate setting then ensures that your listener only fires when a suitable element is clicked. Using this technique there's no need to bind to each row in the list, in fact it will even cope when the contents of the list changes.

    I haven't tried it but you could probably do something like this...

    Ext.create('Ext.form.field.ComboBox', {
        listConfig: {
            listeners: {
                el: {
                    click: {
                        delegate: 'a.iol-combo-list-item-action',
                        fn: function(ev, anchor) {
    Check out the docs for these settings for more info.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts