Results 1 to 7 of 7

Thread: After widgetcolumn setVisible(false) in onWidgetAttach, can't setVisible(true)

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-23030 in 6.2.2.
  1. #1

    Default After widgetcolumn setVisible(false) in onWidgetAttach, can't setVisible(true)

    Hello,

    I've tried searching the forum to see if this issue has already been reported but I can't see anything relevant, so apologies in advance in case it has.

    I have a grid with a widgetcolumn where I'm setting setVisible(false) selectively based on criteria.

    I'm finding that even after clearing out all of the data and reconfiguring, setting setVisible(true) on the same row's widgetcolumn in subsequent onWidgetAttach doesn't actually make the widgetcolumn visible.

    This worked in 6.0.2.437 but no longer works in 6.2.0.981.

    You can find a fiddle of the issue at: https://fiddle.sencha.com/#fiddle/1jnk

    To recreate the issue, load the fiddle and then:

    1. Toggle the Is Visible status to "false"
    2. Press Reconfigure to fire onWidgetAttach and hide the widgetcolumn
    3. Toggle the Is Visible status to "true"
    4. Press Reconfigure to fire onWidgetAttach and (fail to) show the widgetcolumn

    I've also tried replacing onWidgetAttach with the new bind syntax for 6.2. This is having the same issue.

    Thanks in advance!

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    Calling reconfigure with no parameters is a no-op.

    You should do something like this:

    https://fiddle.sencha.com/#fiddle/1jpe
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3

    Default

    Thanks for the swift reply.

    We've got a separate issue when using bind and loading new data to the store as I've documented in a new fiddle: https://fiddle.sencha.com/#fiddle/1jpo

    As you can see, when you load data to the store it doesn't automatically update show the appropriate widgetcolumns, although they will display if you toggle the visibility off and then back on.

    Thanks in advance for your ongoing support.

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    That looks like a bug, there's some code that tries to manage the visible state inside the grid.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5

    Default

    Ah, I'm glad I've actually found a bug and it's not just me being dumb this time!

    Do you know of any potential work-arounds? We're hoping to push our code using 6.2 into Beta next Tuesday and would like to come up with something.

    Thanks again,

    Tommy

  6. #6
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    If you look in RowContext.js, there are 2 places where it sets .hidden = true/false, you should just be able to remove those lines.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  7. #7
    Sencha User
    Join Date
    Apr 2013
    Posts
    137

    Default

    the workaround as Evant says can be something like this :

    Code:
    Ext.override(Ext.grid.RowContext, {
        free: function () {
            var me = this,
                widgets = me.widgets,
                widgetId,
                widget,
                focusEl,
                viewModel = me.viewModel;
    
    
            me.record = null;
            if (viewModel) {
                viewModel.set('record');
                viewModel.set('recordIndex');
            }
    
    
            // All the widgets this RowContext manages must be blurred 
            // and moved into the detached body to save them from garbage collection. 
            for (widgetId in widgets) {
                widget = widgets[widgetId];
    
    
                // Focusables in a grid must not be tabbable by default when they get put back in. 
                focusEl = widget.getFocusEl();
                if (focusEl) {
                    // Widgets are reused so we must reset their tabbable state 
                    // regardless of their visibility. 
                    // For example, when removing rows in IE8 we're attaching 
                    // the nodes to a document-fragment which itself is invisible, 
                    // so isTabbable() returns false. Next time when we're reusing 
                    // this widget it will be attached to the document with its 
                    // tabbable state unreset, which might lead to undesired results. 
                    if (focusEl.isTabbable(true)) {
                        focusEl.saveTabbableState({
                            includeHidden: true
                        });
                    }
    
    
                    // Some browsers do not deliver a focus change upon DOM removal. 
                    // Force the issue here. 
                    focusEl.blur();
                }
                widget.detachFromBody();
              //  widget.hidden = true;commented as a workaround
            }
        },
    
    
        getWidget: function (view, ownerId, widgetCfg) {
            var me = this,
                widgets = me.widgets || (me.widgets = {}),
                ownerGrid = me.ownerGrid,
                rowViewModel = ownerGrid.rowViewModel,
                rowVM = me.viewModel,
                result;
    
    
            // Only spin up an attached ViewModel when we instantiate our first managed Widget 
            // which uses binding. 
            if ((widgetCfg.bind || rowViewModel) && !rowVM) {
                if (typeof rowViewModel === 'string') {
                    rowViewModel = {
                        type: rowViewModel
                    };
                }
    
    
                me.viewModel = rowVM = Ext.Factory.viewModel(Ext.merge({
                    parent: ownerGrid.lookupViewModel(),
                    data: {
                        record: me.record,
                        recordIndex: me.recordIndex
                    }
                }, rowViewModel));
            }
    
    
            if (!(result = widgets[ownerId])) {
                result = widgets[ownerId] = Ext.widget(Ext.apply({
                    ownerCmp: view,
                    _rowContext: me,
                    $vmParent: rowVM || ownerGrid.lookupViewModel(),
                    initInheritedState: me.initInheritedStateHook,
                    lookupViewModel: me.lookupViewModelHook
                }, widgetCfg));
    
    
                result.$fromLocked = !!view.isLockedView;
    
    
                // Components initialize binding on render. 
                // Widgets in finishRender which will not be called in this case. 
                // That is only called when rendered by a layout. 
                if (result.isWidget) {
                    result.initBindable();
                }
            } else {
              //  result.hidden = false; commented as workaround
            }
    
    
            return result;
        },
    });

Similar Threads

  1. Replies: 2
    Last Post: 1 Apr 2015, 1:16 AM
  2. setVisible(false) on ComboBox still takes space
    By mabco in forum Ext GWT: Discussion
    Replies: 10
    Last Post: 16 Sep 2009, 9:31 AM
  3. [2.2] panel, setVisible true not working
    By maceido in forum Ext 2.x: Bugs
    Replies: 10
    Last Post: 14 Oct 2008, 11:40 PM
  4. [CLOSED] TabItem.setVisible(false) not working
    By PeteW in forum Ext GWT: Bugs (1.x)
    Replies: 5
    Last Post: 8 May 2008, 4:08 AM
  5. Element.setVisible(true, true) keeps Invisible
    By franzisk in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 26 Jun 2007, 5:13 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
  •