Javascript 我们如何在jQuery Datatable调用结果中启动另一个jQuery插件,而不是页面就绪函数?

Javascript 我们如何在jQuery Datatable调用结果中启动另一个jQuery插件,而不是页面就绪函数?,javascript,php,jquery,jquery-plugins,datatables,Javascript,Php,Jquery,Jquery Plugins,Datatables,对于我的web应用程序,iam使用jQuery datatable和ajax从数据库中获取数据。实际上,“icheck”是在jQuery page ready函数中启动的。调用datatable或在datatable中进行任何筛选或搜索后出现的问题是,正确获取数据和icheck复选框显示为正常复选框。 如何在datatable调用中调用icheck插件 <table id="viewcat" class="table table-bordered table-striped mar-bot

对于我的web应用程序,iam使用jQuery datatable和ajax从数据库中获取数据。实际上,“icheck”是在jQuery page ready函数中启动的。调用datatable或在datatable中进行任何筛选或搜索后出现的问题是,正确获取数据和icheck复选框显示为正常复选框。 如何在datatable调用中调用icheck插件

<table id="viewcat" class="table table-bordered table-striped mar-bottom0 mydatatable">
  <thead>
    <tr>
      <th style="width: 9%"><input type="checkbox" class="minimal" id="bulkDelete" /> <button type="submit" id="deleteTriger" name="submit" class="btn btn-primary btn-xs hor-align" value="Delete Selected" >Delete</button></th>
      <th style="width: 2%">Sl.no</th>
      <th style="width: 15%">Category Name</th>                  
      <th style="width: 20%">Reference Links</th>
      <th style="width: 25%">Image</th>
      <th style="width: 15%"></th>
      <th style="width: 10%"></th>
    </tr>
  </thead>                  
</table>
<script>
  $(function (){    
    $("#viewcat").DataTable({
      "fnRowCallback" : function(nRow, aData, iDisplayIndex){               
               $("td:nth-child(2)", nRow).append(aData[7]);
               return nRow;
            },      
      "processing": true,
      "serverSide": true,
      "order": [ 2, "asc" ],
      "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0, 1, 4, 5 ,6] } ],
      "ajax":{
          url :"maincategory/viewdata.php", // json datasource
          type: "post",        
          error: function(){  
          $(".viewcat-error").html("");
          $("#viewcat").append('<tbody class="viewcat-error"><tr><th colspan="7">No data found in the server</th></tr></tbody>');
          $("#viewcat_processing").css("display","none");          
          }
      }
    });

  });
</script>

删除
序号
类别名称
参考链接
形象
脚本如下

<table id="viewcat" class="table table-bordered table-striped mar-bottom0 mydatatable">
  <thead>
    <tr>
      <th style="width: 9%"><input type="checkbox" class="minimal" id="bulkDelete" /> <button type="submit" id="deleteTriger" name="submit" class="btn btn-primary btn-xs hor-align" value="Delete Selected" >Delete</button></th>
      <th style="width: 2%">Sl.no</th>
      <th style="width: 15%">Category Name</th>                  
      <th style="width: 20%">Reference Links</th>
      <th style="width: 25%">Image</th>
      <th style="width: 15%"></th>
      <th style="width: 10%"></th>
    </tr>
  </thead>                  
</table>
<script>
  $(function (){    
    $("#viewcat").DataTable({
      "fnRowCallback" : function(nRow, aData, iDisplayIndex){               
               $("td:nth-child(2)", nRow).append(aData[7]);
               return nRow;
            },      
      "processing": true,
      "serverSide": true,
      "order": [ 2, "asc" ],
      "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0, 1, 4, 5 ,6] } ],
      "ajax":{
          url :"maincategory/viewdata.php", // json datasource
          type: "post",        
          error: function(){  
          $(".viewcat-error").html("");
          $("#viewcat").append('<tbody class="viewcat-error"><tr><th colspan="7">No data found in the server</th></tr></tbody>');
          $("#viewcat_processing").css("display","none");          
          }
      }
    });

  });
</script>

$(函数(){
$(“#视图猫”).DataTable({
“fnRowCallback”:函数(nRow、aData、iDisplayIndex){
$(“第n个孩子(2)”,nRow)。追加(aData[7]);
返回nRow;
},      
“处理”:对,
“服务器端”:正确,
“订单”:[2,“asc”],
“aoColumnDefs”:[{“bSortable”:false,“aTargets”:[0,1,4,5,6]}],
“ajax”:{
url:“maincegory/viewdata.php”//json数据源
类型:“post”,
错误:函数(){
$(“.viewcat error”).html(“”);
$(“#viewcat”).append('在服务器中找不到数据');
$(“#viewcat_处理”).css(“显示”、“无”);
}
}
});
});

请帮助我修复它。

哦。。我终于找到了。。这可能会帮助其他人。。datatable插件中已经有一个api函数代替ajax成功。。那就是“fnDrawCallback”


$(函数(){
$(“#视图猫”).DataTable({
“fnRowCallback”:函数(nRow、aData、iDisplayIndex){
$(“第n个孩子(2)”,nRow)。追加(aData[7]);
返回nRow;
},
“fnDrawCallback”:函数(oSettings){
$('input[type=“checkbox”].minimal,input[type=“radio”].minimal')。i选中({
checkboxClass:'icheckbox_minimal-blue',
无线电课程:“伊拉迪奥蓝”
});},      
“处理”:对,
“服务器端”:正确,
“订单”:[2,“asc”],
“aoColumnDefs”:[{“bSortable”:false,“aTargets”:[0,1,4,5,6]}],
“ajax”:{
url:“maincegory/viewdata.php”//json数据源
类型:“post”,
错误:函数(){
$(“.viewcat error”).html(“”);
$(“#viewcat”).append('在服务器中找不到数据');
$(“#viewcat_处理”).css(“显示”、“无”);
}
}
});
});

iCheck激活的代码在哪里$(函数(){//iCheck for checkbox和radio inputs$('input[type=“checkbox”].minimal,input[type=“radio”].minimal')。iCheck({checkboxClass:'icheckbox_minimal-blue',radioClass:'iradio_minimal-blue'});Put
//选中复选框和无线电输入$('input[type=“checkbox”].minimal,input[type=“radio”].minimal')。选中({checkboxClass:'icheckbox_minimal-blue',radioClass:'iradio_minimal-blue')$.ajax.success
中的code>;ajax success不支持jQuery datatable..它不提供与此相关的任何结果
“ajax”:函数(数据、回调、设置){
在这里提供