2012-02-03 65 views
1

我使用基于组合框选择的jquery选项卡加载数据它首次正常工作,数据正确加载如果我更改当时第一个组合框选择如果我切换到第二个选项卡,并选择第一个选项卡,然后数据加载fine.I不知道为什么它不加载,同时更改第一个选项卡中的combox选择。JQuery选项卡首次单独加载Ajax

在下面的例子中我检查像“价值大号”的条件,如果是“L”然后我需要显示三个选项卡,如果该值不“L”然后我需要显示两个标签。

当两个选项卡显示时,第一个选项卡数据未加载。

$(function() { 
    $("#contractType").change(function(){       

      if($("#contractType").val()=="L") //Combo Selection Values 
       {      
        $("#hidetab").show();//Loading tabs 
        $("#tabs-0").show(); 
        $("#dispEmp").removeClass('ui-tabs-selected ui-state-active'); 

       }//if 

      else 
       { 
        $("#hidetab").hide(); 
        $("#tabs-0").hide();//Hides the first tab      
        $("#tabs-1").show();/*Displays remaining two tabs below*/ 
        $("#tabs-2").show(); 
        $("#dispEmp").addClass('ui-tabs-selected ui-state-active'); 
        $("#jqgrid").show();//Here i am trying to load the data in second tab using ajax call. 
        $("#dispEquip").removeClass('ui-tabs-selected ui-state-active'); 

       } 

    });   

}); 

回答

1

我得到了答案,现在工作正常。

虽然我当时正在改变组合框的基础上我选择制表符的条件。

$("#yourtabId").tabs("option", "selected", 0);//this code will select the index of the tab as selected. 

0->标签索引。

如果我们需要返回选项卡索引值,选择选项卡,然后调用此函数。

$('#yourtabId').tabs({ 
      select: function(event, ui) { 

      ui.index // Will return the selected index of the tabs. 
      } 
     }); 
相关问题