http://www.nabble.com/file/p23310898/pag.gif 

I'm not sure if this is the right place to post it but i'll simply go ahead.

>From the view above the table's data uses the Zend_Paginator to return the
data from the db. 

The following describes what i am doing:

- I am trying to control the pages using Ajax without having to reload the
whole page. 

- The table is housed in a DIV container called 'table_sort'. 

- Each of those numbered page links has an id of lnk1, lnk2 etc.

- Depending on which link is clicked the page no is sent to the controller
which then populates its view script and that gets sent back to the AJAX
callback action which then inserts all the contents of the viewscript into
the DIV Container mentioned above

The whole system works but only by clicking once on any of those links the
table is populated and the control shows the present page number. But the
moment i click on another pagination link the whole page reloads.

So my question is this is there a way of not having this behaviour? Can js
recognise the ids of the newly insert control after table have been
populated?


Any help offered will be deeply appreciated. Thanks
 

Here is my js code:

dojo.addOnLoad(function(){
                                                
dojo.query("[id^=lnk]") . onclick(function(evt){

    evt.preventDefault();
        var source = evt.target.id;
        
         var page      = source.substr(3); 
        
         dojo.xhrGet({
                                 
                                 url: "/venues/pagination-table/page/" + page,
                                 handleAs: "text",
                                 load: function(response){
                                                                                
                                         
                                            dojo.byId("table_sort") . innerHTML 
= response;
                                                return response;
                                 }
                                
                                 });
        
                                                                  
                                                                                
          
                                                                                
          
         });


Action controller:

public function paginationTableAction(){
                            
                                        $this->_helper->layout->disableLayout();
                                
                                        $venues         = new Venues();
                                        $allVenues      = 
$venues->getEventsPerVenue();
                                        
                                        $paginator = 
Zend_Paginator::factory($allVenues);  
                                        //tell the paginator which page we're 
on  
                                        
$paginator->setCurrentPageNumber($this->_getParam('page'));  
                                        
                                        //get page no from url 
                                        $page        = 
$this->_request->getParam('page');
                                        $paginator->setCurrentPageNumber($page);
                                        $paginator->setItemCountPerPage(3);
                                        $this->view->paginator = $paginator;  
                                
                                
                                }


View script:

<?php 
                         
                            $venues            = $this->getNewVenues;
                                ?>

<table width="585" border="0" cellpadding="0" cellspacing="1" class="data">
                                                          <tr>
                                                                <td width="250" 
class="heading" id="left_bg">  Venue  "<?=$this-
baseUrl()?>/img/venues/ddown2.gif" alt="sort"  width="5" height="3"/> </td>
                                                                <td width="140" 
class="heading" >  Category  "<?=$this-
baseUrl()?>/img/venues/ddown2.gif" alt="sort"  width="5" height="3"/> </td>
                                                                <td width="120" 
class="heading" >  Area   "<?=$this-
baseUrl()?>/img/venues/ddown2.gif" alt="sort"  width="5" height="3"/> </td>
                                                                <td width="65" 
class="heading" id="right_bg">  Events  "<?=$this-
baseUrl()?>/img/venues/ddown2.gif" alt="sort"  width="5" height="3"/> </td>
                                                          </tr>
                                                          
                                                                                
                                
                                                                
                                                                                
                                                                                
                        

                                                          <?php foreach 
($this->paginator as $item){ ?>  
                                                                  
                                                                <tr>
                                                                <td 
class="left_bg2"> "/venue/details/id/<?=$item['VenueID'];?
"><?=$item['VenueName'];?> </td>
                                                                <td 
class="table_data2"><?=$item['CategoryName'];?></td>
                                                                <td 
class="table_data2"><?=$item['Area'];?></td>
                                                                <td 
class="right_bg2"><?=$item['Events'];?></td>
                                                          </tr>
                                                          <?}
                                                           ?>                   
                                  
                                                            
                                          </table>
                                          
                                          <!-- pagination control insert-->
                                          <?= 
$this->paginationControl($this->paginator, 'Elastic',
'../partials/_pagination_control.phtml'); ?>





-----
dee
-- 
View this message in context: 
http://www.nabble.com/Zend_paginator-%2B-AJAX-controls-tp23310898p23310898.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to