javascriptjquerytabsember-1

Need to switch tab automatically once the search is complete


I need to switch the particular tab once click the menu button from another tab. I'm having two tabs (having more than 5 tabs depend upon operations) name called "search" and "content". In the "search" tab, I'm having the option called "view Contents". If I click the "view contents" menu on the particular folder, it will show their files in the "content" tab. We have to manually click the "content" tab and need to see the corresponding folder file, but I need to switch the tab to "content" tab when I click on the menu on "search" tab.

Here is the html code for the menu:

<menu-item id="ember11376" class="ember-view item action focused" tabindex="0" title="Show the contents" label="View contents" action="core:showContents">
    <div class="item">
        <table class="menu-item-layout">
            <tbody><tr>
                <td class="icon">
                    <div class="icon-container">
                            <rs-icon id="ember11396" class="ember-view icon" style="width: 1em; height: 1em; font-size: 24px"><icon glyph="select_from_full_list" class="select" style="font-size: 24px;"></icon></rs-icon>
                    </div>
                </td>
                <td class="label">View contents</td>
            </tr>
        </tbody></table>
    </div>
</menu-item> 

The corresponding action code is below:

Core.Action({
    id: 'core:showContents',
    icon: 'select',
    invoke: function (context) {
        var mo = Ember.get(context, 'managedObject'),
            append = global.location.search,
            ctl = Core.Tab.Content.getController();
        ctl.set("loadState", "loading");
        mo.done(function () {
            var resultSet = mo.get('children');
            ctl.set('resultSet', resultSet);
            ctl.get('contentTabs').replace(0, 1, [ resultSet.get('tabContext') ]);
            ctl.set('loadState', 'loaded');
            if (resultSet.get('loadState') === 'new') {
                resultSet.load();
            }
        });
    },
    isValid: 'canView && !isCurrentResultSet && isContainer'
});

The menu click options code is below:

    click: function () {
        var inst = this;
        this.$().fadeOut('fast', function () {
            inst.constructor.removeAll();
        });
    }

The manual tab click option code is below:

click: function () {
    var tab = this.get('content');
    if (this.get('active')) {
        tab.getController().send('reset');
    } else {
        this.get('controller').activate(tab);
    }
    return false;
}, 

Solution

  • Try with click() property.

    $('#ID').click();