Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Problem

I don't know how to create two sets of pagination links one view.

Background Information

I have a situation where I have parent / child tables that I have to display on the same view - perhaps in two different sections. Each section needs its own set of pagination links. The contents (and therefore, pagination links) in section 2 will change depending on what is selected in the parent section / section 1.

The parent is what I call "subcategories" and the child table is "products". SO when the user comes to the first page, all categories are shown. But once they select a specific category, I want to take them to this view that I'm discussing which will show any subcategories... and any products.

Possible Solution

I'm thinking that I need the following methods in my controller:

public function getsubcategories($categoryID)
{
    1.  find data yu need to display
    2.  set up pagination object
    3.  use add_js method to add ajax call to a method "get_products_in_category" 
        Ajax method to be invoked on document.ready and will return product data.
    4.  load view. 
}

public function get_products_in_cateogry($categoryID)
{
    1. look up products in category
    2.  build html to display products. 
    3.  return string with all html to display product information
    ??? can i create another pagination object here???
}

If you have any suggestions on what's wrong with my idea / how I can accomplish this, I'd really appreciate it

Thank you.

Edit 1

While waiting for a response, i went ahead and tried a little test... and it doesn't seem to be working. I still have the issue where the pagination links displayed in section 2 actually manipulates the data in section 1. I'm going to move post this question in stackoverflow. Thank you.

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.