简体   繁体   English

jQuery UI选项卡加载并选择

[英]Jquery UI Tabs Load and select

I'm using JQuery UI Tabs. 我正在使用JQuery UI选项卡。 I'm navigating on a button click. 我正在单击按钮。 I have 3 tabs. 我有3个标签。 On button click the other two gets activated. 在按钮上单击,其他两个被激活。 Each tab is a separate jsp file integrated into a single jsp which have tabContainer. 每个选项卡是一个单独的jsp文件,集成到具有tabContainer的单个jsp中。

tabNavigationLInk contains the links for jsp loading from controller. tabNavigationLInk包含用于从控制器加载jsp的链接。

on button click i have 在按钮上单击我有

  1.  $("#planningTabContainer").tabs().tabs({disabled: []});
  2.  $('#ui-tabs-2').load("/Plan"+tabNavigationLinks[1]);
  3.  $("#planningTabContainer").tabs("select", "#ui-tabs-2");

Now the problem is that if i Use the line 3 code, The call on load of JSP is happening twice. 现在的问题是,如果我使用第3行代码,则JSP的加载调用将发生两次。 If i don't use the 3rd line code. 如果我不使用第三行代码。 The tab will get loaded but won't be selected. 该选项卡将被加载,但不会被选择。

Does any one has any solution for this. 有没有人对此有任何解决方案。 Selecting a tab without using the "select". 选择一个选项卡而不使用“选择”。 So that the call won't happen twice. 这样通话不会发生两次。

I didn't quite resolved it but got around by making the "cache" property to true, so whenever i wanted to refresh the tab i'll use 我并没有解决问题,但是通过将“ cache”属性设置为true来解决,因此每当我想要刷新选项卡时,我都会使用

  $('#ui-tabs-2').load("/Plan"+tabNavigationLinks[1]); 

otherwise i'll use 否则我会用

  $("#planningTabContainer").tabs("select", "#ui-tabs-2"); 

Hope this help someone. 希望这对某人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM