Results 1 to 3 of 3

Thread: Why does grid scroll if no selection?

  1. #1
    Sencha User
    Join Date
    Sep 2016

    Default Why does grid scroll if no selection?

    I'm having an issue where I have selected a row, but when a column is hidden or made visible, the grid scrolls to the top. It's very frustrating and seems to happen when 'setVisible' is called (also, I'm working with extjs version 4.2.2). Unfortunately, I can't seem to reproduce this exactly in Fiddle. The closest I've come to reproducing it is: the grid scrolls when a column is hidden/displayed and there is no selection.

    Here is my fiddle:

    Basically, I have a checkbox that when you check it will hide Column1; unchecking it will unhide Column1. When the 'Framework' is set to, if I scroll down and check the checkbox for the last item in the grid, the grid automatically scrolls to the top. However, if I had 'selected' that row, and then clicked the checkbox, the grid doesn't scroll to the top.

    Additionally, when I test this with Framework set to '', selecting the checkbox without selecting the row does *not* cause the grid to scroll (the desired behavior).

    Can someone explain what is going on? Why does the grid scroll at all in What changed between that version and to cause the behavior to be different?

    I'd appreciate any input on this.

    Again, my *real* issue is that at my work we're using 4.2.2, and I have a grid that when a column is hidden/shown programmatically by calling setVisible, the grid scrolls to the top even when I have an item selected. I tried adding 'suspendLayouts' and 'resumeLayouts' before and after the call to setVisible, but it didn't help. Any ideas on this issue would be greatly appreciated too, but since I can't yet reproduce it exactly in Fiddle, I know I must be doing something wrong in my code.


  2. #2
    Sencha User
    Join Date
    Feb 2013


    Are you changing your data as well or simply toggling a column?

  3. #3
    Sencha User
    Join Date
    Sep 2016


    Simply toggling the visibility of columns.

    After some debugging today, what I'm finding is that calling setVisible eventually calls Ext.view.AbstractView.refresh(), and in there, even if 'preserveScrollOnRefresh' is set to true, it clears out and seems to reload my grid. But, I'm not sure if the problem is there, or if it's in 'refreshSelection()', which gets called at the end of the Ext.view.Table.refresh() method.

    Below is the Ext.view.Table.refresh method and refreshSelection. The me.callParent(arguments) calls the Ext.view.AbstractView.refresh method.

        refresh:function(){        var me = this;
            // Create horizontal stretcher element if no records in view and there is overflow of the header container.
            // Element will be transient and destroyed by the next refresh.
            if (me.el && me.headerCt && !me.ownerCt.hideHeaders && me.headerCt.tooNarrow && !me.all.getCount()) {
                    role: 'presentation',
                    style:'position:absolute;height:1px;width:1px;left:' + (me.headerCt.getTableWidth() - 1) + 'px'
        refreshSelection: function() {
            var me = this,
                selModel = me.selModel,
                selected, len, i;
            if (selModel.isRowModel) {
                selected = selModel.selected.items;
                len = selected.length;
                for (i = 0; i < len; i++) {
            me.selModel.onLastFocusChanged(null, me.selModel.lastFocused, true); },

Similar Threads

  1. [DUP] IE9 grid column selection checkboxen don't scroll
    By Wendlando in forum Sencha GXT Bugs
    Replies: 0
    Last Post: 7 Dec 2014, 4:51 AM
  2. Grid Panel, Drag Selection with Auto Scroll
    By parky128 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 12 Jul 2013, 10:12 AM
  3. Replies: 1
    Last Post: 21 Oct 2008, 12:18 AM

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