duan198299 2011-09-10 06:20
浏览 46

使用Ajax的选项卡内容,我在选项卡中的javascript无效

So i'm using flowplayer's JqueryTools, tabs for navigation. Everything i'm loading is really simple. Mainly html tables and forms, and they work great. Except on one page where i use tablefilter.free.fr's tablefilter. The table filter will not load when i use the tabs. When i just open the php, then everything works fine. I was wondering if anyone could tell me what i'm doing wrong here? I don't have much experience with javascript.

My main page is really simple.

<script blah blah blah tabletools.js>
<ul class="css-tabs">
<li><a href="ajax1.php">Tab 1</a></li>
<li><a href="ajax2.php">Second tab</a></li>
<li><a href="ajax3.php">An ultra long third tab</a></li>
</ul>


<div class="css-panes">
<div style="display:block"></div>
$(function() {

$("ul.css-tabs").tabs("div.css-panes > div", {effect: 'ajax', hitory: true});

});
</div>

And the ajax.php's are really simple tables, and for some reason the filter doesn't work when i load the page in the tabs. I load the filter with a class in the table, and i think that may be the problem.

<script type="text/javascript" language="javascript" src="TableFilter/tablefilter.js"></script>  

    <table id="table1" cellspacing="0" class="mytable filterable" >  

Any feedback would be appreciated.

  • 写回答

1条回答 默认 最新

  • dougan5772 2011-09-10 07:37
    关注

    jQuery Tools Tabs & TableFilter

    <script type="text/javascript">
        $(function() {
            $('ul.css-tabs').tabs('div.css-panes > div', {
                effect: 'fade',
                history: true,
                onBeforeClick: function(event, i) {
                    // get the pane to be opened
                    var pane = this.getPanes().eq(i);
    
                    // only load once. remove the if ( ... ){ } clause if you want the page to be loaded every time
                    if (pane.is(':empty')) {
                        // load it with a page specified in the tab's href attribute
                        pane.load(this.getTabs().eq(i).attr('href'), function(){
                            setFilterGrid('table'+(i+1));
                        });
                    }
                }
            });
        });
    </script>
    
    1. The above code should come after including jQuery, jQuery Tools Tabs, and TableFilter files.

    2. Your tables should have an incremental id for each tab like table1, table2, table3, ...

    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行