让我简单点
在服务器上处理.php

$aColumns = array('is_active','CompanyName', 'email', 'phone_no', 'web_address','id' );
$sIndexColumn = "id";
$sTable = "inf_company";

同时设置与数据库的连接
现在jquery函数是
"sAjaxSource": "server_processing.php",
                "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
  // Bold the grade for all 'A' grade browsers
  if ( aData[0] != 0 )
  {
  $('td:eq(0)', nRow).html( '<input type="checkbox" name="delid[]" value="'+ aData[5] +'" />' );
  }
  if ( aData[5] != 0 )
  {
   // $('td:eq(4)', nRow).html( '<b>A</b>' ); // You can add your link here!!
 $('td:eq(5)', nRow).html( '<a href=addsubcat.php?id='+ aData[5] +'><img src="./images /edit.png" alt="edit"></a><a href="subcatList.php?del=1&id='+ aData[5] +' "><img  src="./images/del.png" alt="delete"></a>' );
   }
   return nRow;
},
                "fnServerParams": function ( aoData ) {
aoData.push( { "name": "CompanyName",
               "value": "NATIONAL" } );

}

很简单,我想搜索公司名称National..但它不起作用

最佳答案

当我签出datatables.net中的fnServerData示例时,将要发布的参数(即aodata)将在fnServerParams中组装,而不是fnserverdata本身。
所以我认为你应该移动下面的部分:

"fnServerParams": function ( aoData ) {
    aoData.push( { "name": "as_strno",
                   "value": $('#strno').val() },
                 { "name": "as_temp_ref",
                   "value": $('#as_temp_ref').val() });
    aoData.push( { "name": "dateaddedSto",
                   "value": $('#listings_row #dateaddedSto').val() });
}

09-26 03:46