• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI Pagination and JQuery UI Tabs

#1
[eluser]Jan_1[/eluser]
Hi together,
I'm using JQuery UI Tabs (http://docs.jquery.com/UI/Tabs)
and in one tab I want to use CI Pagination.

I do get the pagination links and
on click I get the right url in the browsers adressfield.
But nothing else happens. The site does'nt reload.
:down:
Does JQuery block it? Am I doing a mistake?
Need some help. Thank You!!!!

controller:
Code:
function index()
    {
        $this->load->helper('date');
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->model('FreakAuth_light/kasse/kasse_model');

        $this->load->library('pagination');
        $config['base_url'] = base_url().'index.php/kasse.html#tabs-4/';
        $config['total_rows'] = $this->db->count_all('ks_buchung');
        $config['per_page'] = '3';
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        $config['first_link'] = 'Neueste';
        $config['last_link'] = '&Auml;lteste';
        $config['next_link'] = '-&gt;';
        $config['prev_link'] = '&lt;-';
        $this->pagination->initialize($config);

        $data['ks_message']       = $this->kasse_model->count_ks_message();
        $data['ks_buchungen'] = $this->kasse_model->get_allmy_ks_buchungen($config['per_page'],$this->uri->segment(1));
        $data['my_ks_buchungen']  = $this->kasse_model->get_my_ks_buchungen();
        $dataform['heading']      = 'Unsere WG-Kasse';
        $dataform['page']         = $this->config->item('FAL_template_dir').'template/kasse/start_kasse_temp';

        $this->load->vars($data);
        $this->load->view($this->_container, $dataform);
    }

kasse_model:
Code:
function get_allmy_ks_buchungen($num, $offset)
    {
      $wg_id = 0815;

      $this->db->where('wg_id', $wg_id, FALSE);
      $this->db->where('user_id', $this->db_session->userdata('id'), FALSE);
      $this->db->order_by('ks_datum desc, id desc');
      $query = $this->db->get('ks_buchung', $num, $offset);
      if ($query->num_rows() > 0) { $data = $query->result();}
      if (isset($data)){return $data;}
     }

view:
Code:
[removed]
    $(function() {
        $("#tabs").tabs();
    });
    [removed]
<div id=headline>&lt;?=$heading?&gt;</div>
<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Overview</a></li>
        <li><a href="#tabs-2">Who paid last times</a></li>
        <li><a href="#tabs-3">community cash box</a></li>
        <li><a href="#tabs-4">My oulays</a>
    </ul>
...
...
<div id="tabs-4">
<div id=headline>cash box: My outlays</div>
<table class=finance>
  <tr>
    <td align='left'><font size='-2'>Datum</font></td>
    <td align='left'><font size='-2'>Text</font></td>
    <td align='left'><font size='-2'>Betrag</font></td>
    <td align='left'><font size='-2'>Art</font></td>
    <td align='left'><font size='-2'>Auslage&nbsp;f&uuml;r</font></td>
   </tr>
&lt;?php $count = 1;
  if (isset($my_ks_buchungen))
     { foreach($my_ks_buchungen as $buchung):?&gt;
  <tr>
    <td><font size='-2'>&lt;?=$buchung->ks_datum?&gt;</font></td>
    <td><font size='-2'>&lt;?=$buchung->ks_text?&gt;</font></td>
    <td align='right'><font size='-2'>&lt;?=$buchung->ks_betrag?&gt;</font></td>
    <td><font size='-2'>&lt;?=$buchung->ks_art?&gt;</font></td>
    <td><font size='-2'>&lt;?=$buchung->ks_auslage?&gt;</font></td>
   </tr>

&lt;?php  endforeach;
  }?&gt;
&lt;?php echo "</table>".$this->pagination->create_links(); ?&gt;
</table>
</div>

#2
[eluser]LuckyFella73[/eluser]
I don't know if that the problem but the offset value seems to be not right:
Code:
$data['ks_buchungen'] = $this->kasse_model->get_allmy_ks_buchungen($config['per_page'],$this->uri->segment(1));

Code:
$this->uri->segment(1) // usually returns your controller name - no offset value

#3
[eluser]Jan_1[/eluser]
Thank you LuckyFella73,

you are right, but that doesn't solve the problem.
Any other Idea?

More hints from everybody would be great!!!!

Greetings, Jan

#4
[eluser]HarishKumar[/eluser]
Hi Jan
I have read your code..
There is a problem in ur offset.

Follow this link.This will really help you.

http://ellislab.com/forums/viewthread/138528/
This link provide you a good solution.
By using this code you will be able to perform pagination using ajax in jquery.
You will not have to always post your page by click on the links provided by create_links.
By using the link provided above you can send request through ajax.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.