3

让我在 server_processing.php 上让它变得非常简单

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

还设置连接到 db 现在 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..但它不起作用

4

1 回答 1

3

当我查看fnServerDatadatatables.net 中的示例时,将发布的参数(即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() });
}
于 2013-03-18T13:35:19.973 回答