Jquery mobile ajax调用后,列切换模式下的jQuery移动表/列按钮不起作用

Jquery mobile ajax调用后,列切换模式下的jQuery移动表/列按钮不起作用,jquery-mobile,html-table,Jquery Mobile,Html Table,问题是: js脚本通过ajax调用PHP脚本。该脚本构建一些html代码,在columnttoggle模式下生成一个h3标题和一个表块。结果被插入my_content div中,并调用table()以jqm方式绘制表格 function get_table() { $.ajax({ type:'post',dataType:'text',cache:false ,url:'script.php' ,data:({token:tok, sort:srt}) ,success:f

问题是:

js脚本通过ajax调用PHP脚本。该脚本构建一些html代码,在
columnttoggle
模式下生成一个h3标题和一个表块。结果被插入my_content div中,并调用
table()
以jqm方式绘制表格

function get_table()
{   $.ajax({
    type:'post',dataType:'text',cache:false
    ,url:'script.php'
,data:({token:tok, sort:srt})
,success:function(data,status,request)
    {   $('#my_content').html(data);
        if($('#my_table').length) $('#my_table').table();
}
}

<body>
<div id="my_content"></div>
</body>
那也行

我的问题是,在使用新的排序条件重新绘制表之后,“列”按钮对显示/隐藏表列不再起作用

我尝试用以下方法清理表对象及其事件:

$('#my_table').empty(); or $('#my_content').empty();
以前

$('#my_content').html(data);
还有其他一些把戏,但我被卡住了

注:

不太管用

似乎我必须打更多的电话告诉jqm我希望该表作为一个新表重新处理

更新:我写了一个例子来说明这个问题:

尝试添加这个$(“#my_table-popup-popup”).remove()此处:

$('#my_content').html(code);
$("#my_table-popup-popup").remove();  
if($('#my_table').length) $('#my_table').table();
我在这个答案中找到了解决方案:

似乎工作:

$('#my_content').html(data);
$('#my_table').trigger('create');
$('#my_content').html(code);
$("#my_table-popup-popup").remove();  
if($('#my_table').length) $('#my_table').table();