Welcome Guest, Not a member yet? Register   Sign In
Pagination issue
#11

[eluser]the_unforgiven[/eluser]
base url is:
Code:
$config['base_url'] = base_url() . 'clients/reports/list_all/';

i have changed the uri_segment to 5 but returns on next page has page not found
#12

[eluser]the_unforgiven[/eluser]
Any ideas?
#13

[eluser]InsiteFX[/eluser]
Your not getting your database records with the limit offset.

This uses modules and my jQuery extended pagination but shuld still work for normal

Code:
// --------------------------------------------------------------------

/**
  * manage()
  *
  * Manage the user database records.
  *
  * @access public
  * @param string
  * @return void
  */
public function manage($offset = '')
{
  // Load the fx_pagination library.
  $this->load->library('fx_pagination');

  // Setup the record limit and get a total count of all table records.
  $limit = 10;
  $count = $this->groups->count_all();

  /**
   * ----------------------------------------------------------------------
   * FX Pagination Configuration.
   * ----------------------------------------------------------------------
   * The base_url and segment below must be set to the correct URL and the
   * segment must be set to the correct segment number or it WILL NOT WORK!
   * ----------------------------------------------------------------------
   */
  $config = array(
   'base_url'      => base_url('groups/manage/'),
   'uri_segment'   => 3,
   'full_tag_open' => '<div id"content" class="text-center"><ul class="pagination pagination-sm page-manage">',
   'display_pages' => TRUE,
   'per_page'      => $limit,
   'total_rows'    => $count,
   'num_links'     => 4,
   'show_count'    => TRUE,
  );

  // Initialize the fx_pagination configuration.
  $this->fx_pagination->initialize($config);

  // Get the database records with limit and offset.
  $order_by  = 'user_id asc';
  $query = $this->groups->get_with_limit($limit, $offset, $order_by);

  // Setup the data array and display the view.
  $data = array(
   'data_grid'   => $query->result(),
   'pager_links' => $this->fx_pagination->create_links(),
   'view_file'   => 'manage',
  );

  $this->load->module('template');
  $this->template->render('admin_fluid_dashboard', $data);
}
#14

[eluser]the_unforgiven[/eluser]
Thanks InsiteFX but I'm not sure how I would implement this into my code....
#15

[eluser]the_unforgiven[/eluser]
I did print_r() on the following:

Code:
$per_pg = 10;
        $rows = $q->num_rows();
        $codes =  $q->result();

        // pagination
        $config['base_url'] = base_url() . 'clients/reports/list_all/';  
        $config['total_rows'] = $rows;
        $config['per_page'] = $per_pg;

Code:
print_r($config[total_rows]); //returns in this instance 45 rows
print_r($config[per_page]); // returns 10 has the variable $per_pg = 10;

So why would this not be paginating when navigating to a new set of records and its showing all records on one page.... What have I missed??
#16

[eluser]the_unforgiven[/eluser]
Please help
#17

[eluser]InsiteFX[/eluser]
See above, you need to get the new records with the page limit and offset.
Code:
$order_by  = 'user_id asc';
  $query = $this->groups->get_with_limit($limit, $offset, $order_by);
#18

[eluser]the_unforgiven[/eluser]
How will that impact on the code then carried through to the view file?

This is like a mini search that searches by 2-3 fields then returns results based on the user's input, So I'm not sure adding the query like you said will make any difference other than cause the code not to then work! Or again am I missing understanding something here...?
Sorry late night coding and early morning coding doesn't mix, maybe I need sleep, but I have to get the search & pagination working by 9am tomorrow UK time
#19

[eluser]Tpojka[/eluser]
I've just tried to google "codeigniter pagination" and got nice explanation of basic example as second result.
First result there is User Guide page for pagination.
#20

[eluser]the_unforgiven[/eluser]
Again already tried all this but still no pagination happens so I've decided against it for now but thanks all for your help




Theme © iAndrew 2016 - Forum software by © MyBB