03-23-2009, 03:36 AM
[eluser]Computerzworld[/eluser]
Here is my customized paging plugin which can be used to display paging with different looks like link, combo & textbox.
You can use & customize it in this way.
Paging plugin is attached along with this post which is modified version of paging plugin that is available on wiki. Please see it & share your reviews.
Thanks.
Here is my customized paging plugin which can be used to display paging with different looks like link, combo & textbox.
You can use & customize it in this way.
Code:
Controller,
$paging = paging($this->page,$this->mdl_test->limit,$this->mdl_test->total,$this->mdl_test->numpages);
$this->nav = create_links($paging,"link",3,$this->page); //
parameters : paging array,"path with parameters",style,page no
Model,
if($this->paginate==TRUE)
{
$this->total = $this->db->count_all_results("table");
$this->numpages = ceil($this->total / $this->limit);
$offset = ($this->page * $this->limit) - $this->limit;
$this->db->limit($this->limit, $offset);
}
Javascript function
function setPageNumber(e,path,pageNo,first,last)
{
var unicode=e.charCode? e.charCode : e.keyCode
if(unicode == 13)
{
if(eval(pageNo) > eval(last))
{
[removed].href= path+'/page/'+last;
}
else if(eval(pageNo) < eval(first))
{
[removed].href= path+'/page/'+first;
}
else
{
[removed].href= path+'/page/'+pageNo;
}
}
if ((unicode<48||unicode>57) && unicode!=8 && unicode!=9 && unicode!=35 && unicode!=36 && unicode!=37 && unicode!=39)
{
return false //disable key press
}
}
Paging plugin is attached along with this post which is modified version of paging plugin that is available on wiki. Please see it & share your reviews.
Thanks.