搜索完成后需要自动切换选项卡



一旦从另一个选项卡单击菜单按钮,我需要切换特定选项卡。我有两个选项卡(有超过 5 个选项卡取决于操作(名称称为"搜索"和"内容"。在"搜索"选项卡中,我有一个名为"查看内容"的选项。如果我单击特定文件夹上的"查看内容"菜单,它将在"内容"选项卡中显示其文件。我们必须手动单击"内容"选项卡,并且需要查看相应的文件夹文件,但是当我单击"搜索"选项卡上的菜单时,我需要将选项卡切换到"内容"选项卡。

以下是菜单的 html 代码:

<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> 

相应的操作代码如下:

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'
});

菜单单击选项代码如下:

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

手动选项卡单击选项代码如下:

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

尝试使用click()属性。

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

最新更新