Results 1 to 3 of 3

Thread: [EXT JS 5.0.0] : When I use scrollTo with the plugin bufferedrender I've a random err

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium User
    Join Date
    Jun 2013
    Posts
    31

    Default [EXT JS 5.0.0] : When I use scrollTo with the plugin bufferedrender I've a random err

    Hello,

    I use a grid with plugin bufferedrender.
    In some cases, after the reconfigure event was launched, I execute scrollTo function to go to my row like this :

    Code:
    goToRowByModel : function(model, scroll) {
            var me = this,
                texteborderNorthGrid = Ext.ComponentQuery.query('#textegrid')[0];
    
    
            if(texteborderNorthGrid) {
                texteborderNorthGrid.getSelectionModel().select(model);
                if(scroll) {
                    indexSelectedRow = texteborderNorthGrid.getStore().indexOf(texteborderNorthGrid.getSelectionModel().getSelection()[0]);
                    texteborderNorthGrid.getPlugin('texteGridBufferedRenderer').scrollTo(indexSelectedRow,false);
                }            
            }
            
        },
    Sometimes I have this error : Uncaught TypeError: Cannot read property 'el' of null ext-all-debug.js:17260

    if I look the code at that line I have :




    Code:
    getOffsetsTo: function(offsetsTo) {
        var o = this.getXY(),
              e = Ext.fly(offsetsTo.el || offsetsTo).getXY();
        return [o[0] - e[0],o[1] - e[1]];
       }
    It seems that offsets is null at that moment.

    I have created a fiddle example but it works. If I can send to you a movie record of my app you can see that it doesn't works for me, but I do the same things of my fiddle.

    Fiddle : https://fiddle.sencha.com/#fiddle/aqi


    In the scrollTo method of BufferedRenderer, I found the line which returns null for offsetsTo argument of getOffsetTO method:

    Code:
    scrollTo: function(recordIdx, doSelect, callback, scope) {
        var me = this,
            view = me.view,
            viewDom = view.el.dom,
            store = me.store,
            total = store.getCount(),
            startIdx, endIdx,
            targetRec,
            targetRow,
            tableTop,
            groupingFeature,
            group,
            record;
    
    
        // If we have a grouping summary feature rendering the view in groups,
        // first, ensure that the record's group is expanded,
        // then work out which record in the groupStore the record is at.
        if ((groupingFeature = view.dataSource.groupingFeature) && (groupingFeature.collapsible !== false)) {
    
    
            // Sanitize the requested record
            recordIdx = Math.min(Math.max(recordIdx, 0), view.store.getCount() - 1);
            record = view.store.getAt(recordIdx);
            group = groupingFeature.getGroup(record);
    
    
            if (group.isCollapsed) {
                groupingFeature.expand(group.getGroupKey());
                total = store.getCount();
            }
    
    
            // Get the index in the GroupStore
            recordIdx = groupingFeature.indexOf(record);
    
    
        } else {
    
    
            // Sanitize the requested record
            recordIdx = Math.min(Math.max(recordIdx, 0), total - 1);
        }
    
    
        // Calculate view start index
        startIdx = Math.max(Math.min(recordIdx - (Math.floor((me.leadingBufferZone + me.trailingBufferZone) / 2)), total - me.viewSize + 1), 0);
        tableTop = Math.max(startIdx * me.rowHeight - me.tableTopBorderWidth, 0);
        endIdx = Math.min(startIdx + me.viewSize - 1, total - 1);
    
    
        store.getRange(startIdx, endIdx, {
            callback: function(range, start, end) {
    
    
                me.renderRange(start, end, true);
    
    
                targetRec = store.data.getRange(recordIdx, recordIdx + 1)[0];
               targetRow = view.getNode(targetRec); // It returns null...
                
                // tableTop property must track the translated position of the body
                view.body.translate(null, me.bodyTop = tableTop);
                me.position = me.scrollTop = tableTop = Math.min(Math.max(0, tableTop - view.body.getOffsetsTo(targetRow)[1]), viewDom.scrollHeight - viewDom.clientHeight);
                view.setScrollY(tableTop);
    
    
                // https://sencha.jira.com/browse/EXTJSIV-7166 IE 6, 7 and 8 won't scroll all the way down first time
                if (Ext.isIE) {
                    view.setScrollY(tableTop);
                }
                if (doSelect) {
                    view.selModel.select(targetRec);
                }
                if (callback) {
                    callback.call(scope||me, recordIdx, targetRec);
                }
            }
        });
    },
    Regards

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

    Default

    Thanks for the report. I haven't been able to recreate this yet. Does it occur for you using 5.0.1 as well?

  3. #3
    Sencha Premium User
    Join Date
    Jun 2013
    Posts
    31

    Default

    I will try and I will keep you informed.

Posting Permissions

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