Tuesday, April 16, 2013

Silent Request Pagination Info

What I am trying to do is create a standard pagination set, but the user has the ability to delete a record using AJAX.

 

So if on page/2 for example standard pagination gets this data:

 

array(

        'page' => (int) 2,

        'current' => (int) 20,

        'count' => (int) 221,

        'prevPage' => true,

        'nextPage' => true,

        'pageCount' => (int) 12,

        'order' => null,

        'limit' => (int) 20,

        'options' => array(

               'page' => (int) 2,

                'conditions' => array()

        ),

        'paramType' => 'named'

)

 

What I need to do is if user using ajax deletes say record 25, that row slides / removed from DOM,

I need to now grab the next record which in this case id 41 (Page 2 of 12, showing 20 records out of 221 total, starting on record 21, ending on 40) and add it to the current pagination set.

 

Basically calling the pagination function after the user deletes the record but grab the next record inline and update the paging count / records, and append the new record to the bottom so there are still the 'limit' => (int) 20, in play.

 

Any ideas how to accomplish this?

 

Thanks,

 

Dave

 

 

No comments: