无法停用jQuery UI选项卡 [英] Trouble disabling jQuery UI tab

查看:94
本文介绍了无法停用jQuery UI选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

API表示您不能禁用活动标签,我认为这是我问题的症结所在.

The API says you can't disable the active tab which I think is the crux of my problem.

我在一个UI选项卡中有六个选项卡.在基于用户单击新的UI手风琴选择的ajax调用为所有选项卡填充数据之后,有时其中一个选项卡为空.每当用户进行新选择时,我都会使用零"标签作为默认的选定标签.

I have six tabs in one UI Tab. One of the tabs is sometimes empty after an ajax call to fill all the tabs with data based on a user's click of a new UI Accordion selection. I use the "zero" tab as the default selected tab whenever the user makes a new selection.

我使用以下代码在加载有时为空的选项卡的php文件中进行编码,以在该选项卡为空时禁用该选项卡.除非用户在单击新的UI手风琴选择时选择了此选项卡,否则它将正常工作.只有在这种情况下,空白标签才会保持启用状态.

I use the following to code in the php file that loads the sometimes empty tab to disable the tab when it's empty. It works fine unless the user has this tab selected when clicking a new UI Accordion selection. In only that case, the empty tab will remain enabled.

?>
    <script type="text/javascript">
      $(document).ready(function() {
          $( "#tabs" ).tabs( "option", "disabled", false);
      });
    </script>
<?php
}else{ 
?>
    <script type="text/javascript">
      $(document).ready(function() {
          $( "#tabs" ).tabs( "option", "disabled", [2]);
      });
    </script>

有人可以建议他出谋划策吗?

Can someone suggest a stragegy?

以下是包含ajax调用的脚本:

Here is the script containing the ajax calls:

<script type="text/javascript">                
    $('.stallion').live('click', function(){
 var id = parseInt(this.id);  // Get stallion_ID from clicked "a" tag id.
 activestallion(id);  // Function to indicate clicked Stallion in Stallion Accordion
        // Start loading Overview Tab
        var request = $.ajax({
            url: "stalliondetails.php",
            type: "GET",
            data: {stallion_ID : id}
        });
        request.done( function(html){
            $("#tabs-1").html(html);
            $( "#tabs" ).tabs( "option", "selected", 0 );
            $(".activehorse").fadeOut('1000', function(){
            document.getElementById("activehorsename").innerHTML
                 =document.getElementById(id).innerHTML;
            $(".activehorse").fadeIn('1000');
            });
            $("#tabs").tabs( "select" , 0 );
        });
        // Overview Tab load finished.
        //Pedigree Tab load starting.
        var request = $.ajax({
        url: "pedigreedetails.php",
        type: "GET",
        data: {stallion_ID : id},
        success: function(html){
        $("#tabs-2").html(html);
        }
        });    
        //Pedigree Tab load finished.
        //Progeny Tab load starting.
        var request = $.ajax({
        url: "progenydetails.php",
        type: "GET",
        data: {stallion_ID : id},
        success: function(html){
        $("#tabs-3").html(html);
        }
        });    
        //Progeny Tab load finished.
        //News Tab load starting.
        var request = $.ajax({
        url: "newsdetails.php",
        type: "GET",
        data: {stallion_ID : id},
        success: function(html){
        $("#tabs-4").html(html);
        }
        });    
        //News Tab load finished.
        //Race Record Tab load starting.
        var request = $.ajax({
        url: "racerecorddetails.php",
        type: "GET",
        data: {stallion_ID : id},
        success: function(html){
        $("#tabs-5").html(html);
        }
        });    
        //Race Record Tab load finished.
        //Analysis Tab load starting.
        var request = $.ajax({
        url: "analysisdetails.php",
        type: "GET",
        data: {stallion_ID : id},
        success: function(html){
        $("#tabs-6").html(html);
        }
        });    
        //Analysis Tab load finished.
        //Update the Seasons Request form to this Stallion.
        updateseasons(id);
        $( "#tabs" ).tabs( "option", "selected", 0 );
        $("button").button() ;       
  });
</script>

感谢您的帮助.

推荐答案

尝试

<script type="text/javascript">
  $(document).ready(function() {
      $( "#tabs" ).tabs( "option", "disabled", 2);
  });
</script>

或多次禁用

 <script type="text/javascript">
  $(document).ready(function() {
      $( "#tabs" ).tabs('option','disabled', [1, 2, 3, 4]);
  });
</script>

代替

<script type="text/javascript">
  $(document).ready(function() {
      $( "#tabs" ).tabs( "option", "disabled", [2]);
  });
</script>

启用标签并转到使用

  $( "#tabs" ).tabs( "enable" , 1 )
  $( "#tabs" ).tabs( "select" , 1 )

*从0开始计数

这篇关于无法停用jQuery UI选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆