Results 1 to 5 of 5

Thread: Bug in Ext.picker.Slot / Ext.scroll.Scroller - ExtJS - v6.0.2.415

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Hillsborough, NC
    Posts
    429

    Default Bug in Ext.picker.Slot / Ext.scroll.Scroller - ExtJS - v6.0.2.415

    There is a bug in Ext.picker.Slot in the modern toolkit. Note the items marked in RED.

    The code below in Ext.picker.Slot sets up a listener for 'scrollend' and a method, 'onScrollEnd', which expects three arguments to handle that event.
    Code:
    //--from modern-- Ext.picker.Slot
    
       initialize: function() {
            this.callParent();
    
            var scroller = this.getScrollable();
    
            this.on({
                scope: this,
                painted: 'onPainted',
                itemtap: 'doItemTap',
                resize: {
                    fn: 'onResize',
                    single: true
                }
            });
    
            this.picker.on({
                scope: this,
                beforehiddenchange: 'onBeforeHiddenChange'
            });
    
            this.element.on({
                scope: this,
                touchstart: 'onTouchStart',
                touchend: 'onTouchEnd'
            });
    
    
           scroller.on({
                scope: this,
                scrollend: 'onScrollEnd'
            });
       },
    
    
        onScrollEnd: function(scroller, x, y) {
            var me = this,
                index = Math.round(y / me.picker.bar.dom.getBoundingClientRect().height),
                viewItems = me.getViewItems(),
                item = viewItems[index];
    
    
            if (item) {
                me.selectedIndex = index;
                me.selectedNode = item;
    
    
                me.fireEvent('slotpick', me, me.getValue(), me.selectedNode);
            }
        },
    The bug is that the 'onScrollEnd' method gets called twice with the second call only having two arguments. This is caused by the code below from Ext.scroll.Scroller.

    Note the 'scrollend' event is fired first with three arguments as the listener set in Ext.picker.Slot is expecting. Next the component's 'onScrollEnd' method is called. As the component is the Ext.picker.Slot, we get a second call to 'onScrollEnd'. This time with two arguments.

    But the method defined in Ext.picker.Slot is expecting three! Plus it does not need to be called twice.
    Code:
    //--from core-- Ext.scroll.Scroller
            fireScrollEnd: function(x, y) {
                var me = this,
                    component = me.component;
    
    
                me.invokePartners('onPartnerScrollEnd', x, y);
    
    
                if (me.hasListeners.scrollend) {
                    me.fireEvent('scrollend', me, x, y);
                }
    
    
                if (component && component.onScrollEnd) {
                    component.onScrollEnd(x, y);
                }
    
    
                Ext.GlobalEvents.fireEvent('scrollend', me, x, y);
            },
    IMHO: The code in Ext.scroller.Scroller is the source of this problem (which may exist elsewhere in the EXTJS/Touch code). You would expect to need to add the listener in Ext.picker.Slot as was done and would probably name the method 'onScrollEnd'. You would probably not expect the method to be called by default if it existed.

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report. This sounds like an issue that was recently fixed in the nightlies. Are you able to test to confirm? If still an issue, can you please post a test case which exhibits the behavior?
    https://fiddle.sencha.com/#home

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Hillsborough, NC
    Posts
    429

    Default

    Yes, this code shown in the first report is still in the nightly builds. I downloaded ext-6.0.2-20160321.zip --> ext-6.0.2.428

    in Ext.picker.Slot in the modern toolkit
    • lines 264-267 in method initialize
    • lines 391-403 method onScrollEnd
    in Ext.scroll.Scroller in the Core package
    • lines 1028-1043 method fireScrollEnd
    I do not have time to put together a test case. I spent a full day and a half already debugging this Picker.

    Look at the code above and the error is obvious! You create a method onScrollEnd which takes 3 arguments and call it in fireScrollEnd twice (each with a different number of arguments).

    Once though the listener setup in the initialize method of Ext.picker.Slot (event fired in fireScrollEnd with three arguments).

    And the second time with the code in fireScrollEnd with the lines
    Code:
    if (component && component.onScrollEnd) {
        component.onScrollEnd(x, y);
    }
    Note that component.onScrollEnd is called with only TWO arguments. OnScrollEnd is defined in Component.js (classic and modern) as having 2 arguments. I think that this is the documentation of the code above calling 'component.onScrollEnd'.

    It appears to me that the listener setup in the initialize method is not needed as fireScrollEnd will call 'component.onScrollEnd'. The number of arguments needs fixing in onScrollEnd.

    This may affect other components. 'grep' shows a few.

    Please do not release 6.0.2 without fixing this! I do not want to wait 6 more months to get this fixed and into a release I can use.

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Hillsborough, NC
    Posts
    429

    Default

    Is this marked as a bug yet? Will it be fixed in v6.0.2?

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Hillsborough, NC
    Posts
    429

    Default

    This did not make the 6.0.2 release.

    Can we get it moved up to the top of the list for a quick fix? It is a very simple bug; just look at the code described above. It is pretty obvious.

    Can you get it fixed and in v6.0.3 which should be released in a month or so?

    Just fix a couple of quick bugs and have another point release. Once a month would be nice for bug fixes. Every other month would be acceptable (but not as good .

Similar Threads

  1. ExtJS 6.0.2.408 - Modern - Picker Slot scrollToItem bug
    By Lukappa in forum Ext JS 6.x Bugs
    Replies: 12
    Last Post: 29 Apr 2016, 11:56 AM
  2. [OPEN] Ext.picker.Slot doesn't position to the right slot item
    By blackswanny in forum Sencha Touch 2.x: Bugs
    Replies: 2
    Last Post: 7 Sep 2012, 1:02 AM
  3. [FIXED] setValue on Ext.picker.Slot does not trigger scroll if value is 0
    By strictlyphp in forum Sencha Touch 2.x: Bugs
    Replies: 2
    Last Post: 5 Jul 2012, 1:20 PM
  4. [FIXED] Ext.picker.Slot `name` issues with slot connected to Ext.data.Store
    By Fedot Praslov in forum Sencha Touch 2.x: Bugs
    Replies: 2
    Last Post: 1 Apr 2012, 10:00 AM
  5. [FIXED] Incomplete setValue() on Ext.picker.Picker (and Ext.picker.Slot) before render/show.
    By strictlyphp in forum Sencha Touch 2.x: Bugs
    Replies: 3
    Last Post: 10 Feb 2012, 2:59 PM

Posting Permissions

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