Problem with Paging and forward with Zend Framework 1

0

I use ZF1 and am having trouble using _forward() , the reason is that if I redirect it to a page with pagination, the url gets the method of the action that was submitted. Well, for example, if I have a pagination and each item has the delete button with its ID and I click to delete and then a forward on the page the URL that was .../index/consultar/pagina/3 gets ../index/apagar?idRegistro=196 and it changes page is ../index/apagar/pagina/5 actually leaving the default, maybe I'm not doing it right.

But follow the paste of the codes. (I'm not the most professional programmer yet, so do not notice much of my bad code at all.)

link - IndexController

link - paginacao.phtml

link - browsing.phtml

And I have this problem with paging also because if I do a search specifying some data (filter) there it brings the first page with data and number of pages equivalent to pagination in the search. But if I go to page 2, it kind of changes the pagination as if it were searching all the data.

    
asked by anonymous 03.02.2015 / 17:57

1 answer

0

Try to submit your search form via GET rather than using POST because the data will stay in the URL when the paginationControl uses the url helper to build the url of the other pages.

In the forward case, use the url helper to build the delete button links.

<a href="<?php echo $this->url(array('controller' => 'minha-controller', 'action' => 'excluir'), null, false); ?>">Excluir</a>

In this way, the submitted parameters of the form will persist in the URL.

    
21.05.2015 / 17:49