我的申请中有两页。第一页具有一个包含三个选项卡的选项卡组。现在,单击第二页中的按钮,我需要将控件重定向到第一页中的第一个选项卡2。我怎样才能做到这一点。
我的代码如下,
<Alloy>
<TabGroup id="myTabGrp"> //Tabgroup Added
<Tab id="one">
<Window class="container">
<Label>This is the Home View</Label>
</Window>
</Tab>
<Tab id="two">
<Window class="container" id="winTwo">
<Label>This is the second View</Label>
</Window>
</Tab>
<Tab id="three">
<Window class="container">
<Button onClick="saveLang">Proceed</Button>
</Window>
</Tab>
</TabGroup>
</Alloy>
第二页
<Alloy>
<Window class="container">
<Button onClick="submitFun">submit</Button>
</Window>
</Alloy>
function submitFun()
{
var homeWindow = Alloy.createController('index').getView();
homeWindow.open({transition:Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});
}
我不愿意加载整个索引页面,因为加载时间会很长。我只需要在索引页面中加载一个标签。我怎样才能做到这一点?
我认为您将在index.js
打开第二页的位置输入代码;也许像:
Alloy.createController('second').getView().open();
现在,second.js
您只需调用close
窗口的方法即可关闭当前窗口并返回index
。
function submitFun()
{
$.second.close(); //id of second window = second
}
现在还为添加一个focus
事件侦听index.js
器,tabgroup
并导航到所需的tab
。
$.myTabGrp.addEventListener('focus',function(e) {
$.myTabGrp.setActiveTab($.two);
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句