Reputation: 4146
How can I link Zend
paginator with Jquery
paginator plug-in ?
I don't want to refresh the pagination links. Only content should change.
Upvotes: 1
Views: 285
Reputation: 13049
Which plugin are you talking about? There are dozens of jQuery paginator plugins out there.
Here's basically all you'll need in your controller:
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$select = $db->select()
->from(array('t' => 'mytable'));
$paginator = Zend_Paginator::factory($select);
$paginator->setDefaultItemCountPerPage(100);
$paginator->setCurrentPageNumber($this->_getParam('p', 1));
echo array(
'data' => $paginator->toJson()
);
And you're jQuery paginator might look something like this:
$("#mytable").paginate({
url : "/controller/action/p/" + page_number
});
I can't really do a whole lot more for you since I'm not sure what plugin you're working with.
Upvotes: 1