Problem occurred during pagination
Permalink 2 users found helpful
Hi, I performing pagination using database item list. I creating this using single page. I am performing search operation here.I'm getting user search values from single page.
After click on the search button I'm performing search operation.
I filter the query using the database item list
All are working perfectly.
But if I'm going to next page from pagination button, I'm getting invalid argument supplied for foreach() error.
before search my url is mysite/index.php/search_leaves/
after going to search function my url is mysite/index.php/search_leaves/search
if I press the second page in pagination button, it show the url like mysite/index.php/search_leaves/?&ccm_paging_p=2
I used the below code in my search function of my controller.
how to solve this problem???
please give some suggestions...
After click on the search button I'm performing search operation.
I filter the query using the database item list
All are working perfectly.
But if I'm going to next page from pagination button, I'm getting invalid argument supplied for foreach() error.
before search my url is mysite/index.php/search_leaves/
after going to search function my url is mysite/index.php/search_leaves/search
if I press the second page in pagination button, it show the url like mysite/index.php/search_leaves/?&ccm_paging_p=2
I used the below code in my search function of my controller.
$LeaveList->setItemsPerPage(10); $this->set('Summary',$LeaveList); $currentPage = Page::getCurrentPage(); $this->set('LeaveList', $LeaveList->getPage()); $this->set('LeavePagination', $LeaveList->displayPagingV2(Loader::helper('navigation')->getLinkToCollection($currentPage), true));
how to solve this problem???
please give some suggestions...
Thanks for the reply Mike,
This line performing The above line second parameter only sending the value from controller to single page.
if I used like this
what value will assign to LeavePagination in single pages from this controller?
$this->set('LeavePagination', $LeaveList->displayPagingV2(Loader::helper('navigation')->getLinkToCollection($currentPage), false));
This line performing The above line second parameter only sending the value from controller to single page.
if I used like this
$this->set('LeavePagination', false, true);
what value will assign to LeavePagination in single pages from this controller?
bump
Do you need to set the name space? I know that helps with pagination on page lists:
$namespace = 'dpm_' . $this->getCollectionObject()->getCollectionID(); $pl->enableStickySearchRequest($namespace);
Thanks for the reply...
Sorry, I could not understand how to use strickySearchRequest. I could not find any detailed documentation or how-to about this.
any way thanks for suggest me to use name space.
It is helped me on showing more than one paginating result.
Sorry, I could not understand how to use strickySearchRequest. I could not find any detailed documentation or how-to about this.
any way thanks for suggest me to use name space.
It is helped me on showing more than one paginating result.
I solved this issue.
In my controller's view function I placed my filter query and set the value from controller to view. This will only will execute if the session variable is set
In my search function I get the search values from single page form and I manually add those values in session. Then simply call view function.
In my application I disabled my browser back button action. so, I placed my button called "back" in my form. If the user click on the back button, I unset the session array values like,
Finally I solved this issue...
Thanks for the help @Mike, @hereNT.
And thanks to @Remo for make me understanding about pagination in concrete5.
Regards,
CJ Ramki
In my controller's view function I placed my filter query and set the value from controller to view. This will only will execute if the session variable is set
public function view() { Loader::model('ListforDetails'); $List = new ListforDetails(); if (isset($_SESSION['var1'])) { $data['var1'] = $_SESSION['var1']; $data['var2'] = $_SESSION['var2']; $data['var3'] = $_SESSION['var3']; $List - > filter('field1', $data['var1'], '='); $List - > filter('field2', $data['var2'], '='); $List - > filter('field3', $data['var3'], '='); } $List - > setItemsPerPage(10); $this - > set('forSummary', $List); $currentPage = Page::getCurrentPage(); $this - > set('LeaveList', $LeaveList - > getPage());
Viewing 15 lines of 17 lines. View entire code block.
In my search function I get the search values from single page form and I manually add those values in session. Then simply call view function.
public function search() { $data['var1']=$this->post('val1'); $data['var2']=$this->post('val2'); $data['var3']=$this->post('val3'); foreach ($data as $key=>$sessData) { $_SESSION[$key]=$sessData; } echo $this->view(); }
In my application I disabled my browser back button action. so, I placed my button called "back" in my form. If the user click on the back button, I unset the session array values like,
Finally I solved this issue...
Thanks for the help @Mike, @hereNT.
And thanks to @Remo for make me understanding about pagination in concrete5.
Regards,
CJ Ramki
to
Regards,
Mike
http://mkly.io