Results 1 to 5 of 5

Thread: Grid with locked column and preserveScrollOnRefresh doesn't work

    You found a bug! We've classified it as EXTJS-27719 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1

    Exclamation Grid with locked column and preserveScrollOnRefresh doesn't work

    Scroll to the middle of the grid, and click on the tool for doing a refresh view, the scroll move to the top

    the grid have a locked colum, preserveScrollOnRefresh on the view .... all seem to be ok !

    https://fiddle.sencha.com/#view/editor&fiddle/2na4

  2. #2
    Sencha - Forum Administrator
    Join Date
    Sep 2017
    Posts
    1,006

    Default

    Hello there,

    Sorry for the trouble. I have shared this with the support team. We appreciate you bringing this to our attention.

    Michele

  3. #3
    Ext Support Team
    Join Date
    Jan 2018
    Posts
    542

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  4. #4
    Sencha Premium Member
    Join Date
    Nov 2015
    Location
    France
    Posts
    4

    Default

    Quote Originally Posted by rakumar View Post
    Thanks for the report! I have opened a bug in our bug tracker.
    Hello,

    Some news about this bug resolution ?

    It's very urgent, customers are angry for long time now...

  5. #5
    Sencha Premium Member
    Join Date
    Nov 2015
    Location
    France
    Posts
    4

    Default

    Quote Originally Posted by tnehr View Post
    Hello,

    Some news about this bug resolution ?

    It's very urgent, customers are angry for long time now...
    Seems to be fixed by another bug fix in EXT-7 framework nightly build.

    Modifications below seems to work for me.... See them and adapt if needed....

    Create "Lockable.js" file in "overrides\grid\locking" directory and ovverride "beforeLayout" and "doSyncLockableLayout" functions.

    Code below is for Ext-6.5.3 or Ext-6.6.0 (i don't remenber exactly) ovverride, look for EXTJS-27719 string.

    Code:
    Ext.define('Override.grid.locking.Lockable', {
        override : 'Ext.grid.locking.Lockable',
        beforeLayout: function() {
            var me = this,
                lockedGrid = me.lockedGrid,
                normalGrid = me.normalGrid,
                totalColumnWidth;
            if (lockedGrid && normalGrid) {
                // The locked side of a grid, if it is shrinkwrapping fixed size columns, must take into
                // account the column widths plus the border widths of the grid element and the headerCt element.
                // This must happen at this late stage so that all relevant classes are added which affect
                // what borders are applied to what elements.
                if (lockedGrid.getSizeModel().width.shrinkWrap) {
                    lockedGrid.gridPanelBorderWidth = lockedGrid.el.getBorderWidth('lr');
                    lockedGrid.shrinkWrapColumns = true;
                }
                if (lockedGrid.shrinkWrapColumns) {
                    totalColumnWidth = lockedGrid.headerCt.getTableWidth();
                    if (isNaN(totalColumnWidth)) {
                        Ext.raise("Locked columns in an unsized locked side do NOT support a flex width.");
                    }
                    lockedGrid.setWidth(totalColumnWidth + lockedGrid.gridPanelBorderWidth);
                    // setWidth will clear shrinkWrapColumns, so force it again here
                    lockedGrid.shrinkWrapColumns = true;
                }
                if (!me.scrollContainer) {
                    me.initScrollContainer();
                }
    
                //EXTJS-27719
                //me.lastScrollPos = me.getScrollable().getPosition(); // BUG
                me.lastScrollPos = Ext.clone(me.getScrollable().getPosition()); // FIX
    
                // Undo margin styles set by afterLayout
                lockedGrid.view.el.setStyle('margin-bottom', '');
                normalGrid.view.el.setStyle('margin-bottom', '');
            }
        },
        doSyncLockableLayout: function() {
            var me = this,
                collapseExpand = me.isCollapsingOrExpanding,
                lockedGrid = me.lockedGrid,
                normalGrid = me.normalGrid,
                lockedViewEl, normalViewEl, lockedViewRegion, normalViewRegion, scrollbarSize, scrollbarWidth, scrollbarHeight, normalViewWidth, normalViewX, hasVerticalScrollbar, hasHorizontalScrollbar, scrollContainerHeight, scrollBodyHeight, lockedScrollbar, normalScrollbar, scrollbarVisibleCls, scrollHeight, lockedGridVisible, normalGridVisible, scrollBodyDom, viewRegion, scrollerElHeight, scrollable;
            me.afterLayoutListener = null;
            if (collapseExpand) {
                // Expand
                if (collapseExpand === 2) {
                    me.on('expand', 'doSyncLockableLayout', me, {
                        single: true
                    });
                }
                return;
            }
            if (lockedGrid && normalGrid) {
                lockedGridVisible = lockedGrid.isVisible(true) && !lockedGrid.collapsed;
                normalGridVisible = normalGrid.isVisible(true);
                lockedViewEl = lockedGrid.view.el;
                normalViewEl = normalGrid.view.el;
                scrollBodyDom = me.scrollBody.dom;
                lockedViewRegion = lockedGridVisible ? lockedGrid.body.getRegion(true) : new Ext.util.Region(0, 0, 0, 0);
                normalViewRegion = normalGridVisible ? normalGrid.body.getRegion(true) : new Ext.util.Region(0, 0, 0, 0);
                scrollbarSize = Ext.getScrollbarSize();
                scrollbarWidth = scrollbarSize.width;
                scrollbarHeight = scrollerElHeight = scrollbarSize.height;
                normalViewWidth = normalGridVisible ? normalViewRegion.width : 0;
                normalViewX = lockedGridVisible ? (normalGridVisible ? normalViewRegion.x - lockedViewRegion.x : lockedViewRegion.width) : 0;
                hasHorizontalScrollbar = (normalGrid.headerCt.tooNarrow || lockedGrid.headerCt.tooNarrow) ? scrollbarHeight : 0;
                scrollContainerHeight = normalViewRegion.height || lockedViewRegion.height;
                scrollBodyHeight = scrollContainerHeight;
                lockedScrollbar = me.lockedScrollbar;
                normalScrollbar = me.normalScrollbar;
                scrollbarVisibleCls = me.scrollbarVisibleCls;
                scrollable = me.getScrollable();
                // EXTJS-23301 IE10/11 does not allow an overflowing element to scroll
                // if the element height is the same as the scrollbar height. This
                // affects the horizontal normal scrollbar only as the vertical
                // scrollbar container will always have a width larger due to content.
                if (Ext.supports.CannotScrollExactHeight) {
                    scrollerElHeight += 1;
                }
                if (hasHorizontalScrollbar) {
                    lockedViewEl.setStyle('margin-bottom', -scrollbarHeight + 'px');
                    normalViewEl.setStyle('margin-bottom', -scrollbarHeight + 'px');
                    scrollBodyHeight -= scrollbarHeight;
                    if (lockedGridVisible && lockedGrid.view.body.dom) {
                        me.lockedScrollbarScroller.setSize({
                            x: lockedGrid.headerCt.getTableWidth()
                        });
                    }
                    if (normalGrid.view.body.dom) {
                        me.normalScrollbarScroller.setSize({
                            x: normalGrid.headerCt.getTableWidth()
                        });
                    }
                }
                me.scrollBody.setHeight(scrollBodyHeight);
                lockedViewEl.dom.style.height = normalViewEl.dom.style.height = '';
                scrollHeight = (me.scrollable.getSize().y + hasHorizontalScrollbar);
                normalGrid.view.stretchHeight(scrollHeight);
                lockedGrid.view.stretchHeight(scrollHeight);
                hasVerticalScrollbar = scrollbarWidth && scrollBodyDom.scrollHeight > scrollBodyDom.clientHeight;
                if (hasVerticalScrollbar && normalViewWidth) {
                    normalViewWidth -= scrollbarWidth;
                    normalViewEl.setStyle('width', normalViewWidth + 'px');
                }
                lockedScrollbar.toggleCls(scrollbarVisibleCls, lockedGridVisible && !!hasHorizontalScrollbar);
                normalScrollbar.toggleCls(scrollbarVisibleCls, !!hasHorizontalScrollbar);
                // Floated from collapsed views must overlay. THis raises them up.
                me.normalScrollbarClipper.toggleCls(me.scrollbarClipperCls + '-floated', !!me.normalGrid.floatedFromCollapse);
                me.normalScrollbar.toggleCls(me.scrollbarCls + '-floated', !!me.normalGrid.floatedFromCollapse);
                me.lockedScrollbarClipper.toggleCls(me.scrollbarClipperCls + '-floated', !!me.lockedGrid.floatedFromCollapse);
                me.lockedScrollbar.toggleCls(me.scrollbarCls + '-floated', !!me.lockedGrid.floatedFromCollapse);
                lockedScrollbar.setSize(me.lockedScrollbarClipper.dom.offsetWidth, scrollerElHeight);
                normalScrollbar.setSize(normalViewWidth, scrollerElHeight);
                me.setNormalScrollerX(normalViewX);
                if (lockedGridVisible && normalGridVisible) {
                    viewRegion = lockedViewRegion.union(normalViewRegion);
                } else if (lockedGridVisible) {
                    viewRegion = lockedViewRegion;
                } else {
                    viewRegion = normalViewRegion;
                }
                me.scrollContainer.setBox(viewRegion);
                me.onSyncLockableLayout(hasVerticalScrollbar, viewRegion.width);
    
                //EXTJS-27719
                // We should only scroll if necessary
                //if (!Ext.Object.equals(scrollable.position, me.lastScrollPos)) { // BUG
                if (!Ext.Object.equals(scrollable.getPosition(), me.lastScrollPos)) { // FIX
                    scrollable.scrollTo(me.lastScrollPos);
                }
            }
        }
    });

Similar Threads

  1. Replies: 3
    Last Post: 23 Oct 2014, 4:48 AM
  2. Replies: 7
    Last Post: 21 Jul 2014, 1:56 AM
  3. Replies: 9
    Last Post: 29 Mar 2013, 12:17 AM
  4. Replies: 2
    Last Post: 28 Feb 2013, 6:20 AM
  5. Replies: 0
    Last Post: 24 Aug 2011, 11:06 AM

Posting Permissions

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