Simple Ajax paging with existing pagination lib & jQuery |
[eluser]Berserk[/eluser]
Step 1: edit existing pagination lib: a. Find: Code: var $query_string_segment = 'per_page'; Add below: Code: var $is_ajax_paging = FALSE; b. Find: Code: if ($num_pages == 1) Add below: Code: if($this->is_ajax_paging == TRUE) c. add '.$paging_function.' on all of a element you found in Pagination.php ex: Code: <a > Code: <a+'.$paging_function.'> //remove plus Step 2: config your paging in controller (similar with default paging config): if you want to use ajax paging just add Quote:$config['is_ajax_paging'] = TRUE; //default FALSE if don't, set it to FALSE Ex: Code: // Set pagination Step 3: Set your view: Exp: Code: <div id = 'display-content'> Step4 : create jQuery paging function Code: ajax_paging = function(){ Finish! --------------------- You can use both non-ajax paging and ajax paging at same time, no need to rewrite your code (just need change $config['is_ajax_paging'] to TRUE or FALSE ). Hope it will help (sorry for my bad english)
[eluser]mrliam69[/eluser]
So does Code: <a+ href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; become (without the plus after the a) Code: <a+ '.$paging_function.' href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close;
[eluser]sihijau[/eluser]
could you give me demo and download files with instruction, please? i'm newbie
[eluser]sihijau[/eluser]
could u give me demo and download files, please? i'm a newbie. thanks
[eluser]jiahui[/eluser]
hello, I followed exactly the explanation as Berserk described and applied it into my project. But I get this error msg: Parse error: syntax error, unexpected T_VARIABLE .... What is the problem on this line: Code: $this->pagination->initialize($config); Below is the scripting which I added into controller: Code: // Set pagination
[eluser]charlie spider[/eluser]
you forgot the semicolon ; after config['paging_function'] = 'ajax_paging' but you've probably figured that out by now.
[eluser]Amzad Hossain[/eluser]
http://tohin.wordpress.com/2008/08/12/co...agination/ http://tohin.wordpress.com/2008/10/07/co...guideline/
|
Welcome Guest, Not a member yet? Register Sign In |