我花了很多时间在这个问题上我将DataTable Jquery用于Zend Framework控制器中的以下操作:
public function getlistusersajaxAction()
{
$users = new Admin_Model_DbTable_User();
$param = $this->_request->getParam('filter','all');
$results = ($param === 'all') ? $users->fetchAll()->toArray() : $users->fetchAll($users->select()->where('rankUser = ?', $param))->toArray();
$results = array();
$results = array(
"iTotalRecords" => 34,
"iTotalDisplayRecords" => 34,
"aaData" => array()
);
$this->_helper->json->sendJson($results);
在index.phtml中输入以下代码:
<script type="text/javascript">
$(document).ready(function() {
var table = $('#table-user').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/<?=Zend_Registry::get('Zend_Locale')->getLanguage();?>/admin/UserManagement/getlistusersajax/filter/"
我试图找到一些关于此处应用的解决方案的指导,但它没有给我带来成功。
我能错过什么? 提前谢谢。