István
István

Reputation: 5127

Scroll event on ExtJS combobox picker

I want to add handler to scroll event on combobox's picker scroll, but scroll event is not fired.

    Ext.define('Test.MyCombo', {
        extend:'Ext.form.field.ComboBox',
        createPicker: function() {
            var me = this,
                picker = me.callParent(arguments);
            me.mon(picker, {
                'afterrender' : function() {
                    picker.getTargetEl().on('scroll', function(){
                        console.log('scroll?');
                    }, me);
                },
                scope: me
            });
            return picker;
        },
    });

Upvotes: 0

Views: 762

Answers (2)

JChap
JChap

Reputation: 1441

You should listen on Picker instead of targetEl.

Ext.define('Test.MyCombo', {
        extend:'Ext.form.field.ComboBox',
        createPicker: function() {
            var me = this,
                picker = me.callParent(arguments);

             picker.on('scroll', function(){
                 console.log('scroll?');
             }

            return picker;
        },
    });

Here is the fiddle https://fiddle.sencha.com/#fiddle/17bb

Upvotes: 1

Le Phuc Tai
Le Phuc Tai

Reputation: 1

You need to register event 'schroll' when render your combobox

listeners: {
      render: function(p){
        p.body.on('scroll', function(){
          // do stuff
        }, p);
      }
    }

Upvotes: 0

Related Questions