如果我在CodeIgniter中使用modal in action按钮,则fnDraw无效

时间:2015-09-15 11:11:33

标签: php jquery ajax codeigniter datatables

在手动页面上刷新模态工作正常。但是当使用Ajax重新加载数据表时,弹出窗口停止工作。

以下是我的HTML和JavaScript代码:

<table class="table table-bordered table-striped table-hover mb-none" id="IVRFilesTable">
<thead>
    <tr class="primary">
        <th>IVR Name</th>
        <th>Actions</th>
    </tr>
</thead>
<tbody id="tablediv">
<?php foreach($records as $row) {?>
    <tr>
        <td><?php echo $row['ivrname']?></td>
        <td width="10%" class="actions text-center">
            <a href="#dialogRemoveSuppliers" id="removeIvr" data-id="<?php echo $row['id']?>" data-toggle="tooltip" title="Remove" class="mb-xs mt-xs mr-xs modal-with-zoom-anim modal-sizes"><i class="fa fa-trash-o fa-lg text-primary"></i></a>
        </td>
    </tr>
<?php }?>
</tbody>

var request = $.ajax({
  url: "<?php echo base_url();?>index.php/admin/manageivrs/removeivr",
  type: "POST",
  data: "ivrid="+ivrid,
  success: function (msg)
  {
    if(msg=='true')
    {
        var oTable = $('#IVRFilesTable').dataTable();
        oTable.fnClearTable();
              $("#IVRFilesTable").load(location.href+" #IVRFilesTable>*","");
        oTable.fnDraw();
    }
  }
});

0 个答案:

没有答案