Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/01/2011, 23:42
bisho
 
Fecha de Ingreso: marzo-2007
Mensajes: 9
Antigüedad: 17 años, 1 mes
Puntos: 0
Mostrar Cantidad de Páginas en DataGrid PHP Mysql

Hola, espero que alguna persona pueda ayudarme...

tengo un datagrid que muestra los registros de una BD Mysql, esta hecho en PHP con Ajax, el caso es que este muestra en la parte de abajo la cantidad de Páginas en una combobox, lo que desearía es que los mostrara en links osea (1,2,3,4,etc..) también con un boton "siguiente" "anterior" como si fuera un buscador, reitero, actualmente solo muestra las paginas dentro de un combobox y ya ahi se puede ir a la página para mostrar los registros.

Este es el código:

Código PHP:
function getDispNumDropDown()
    {
        
$value $this->displayNumInc;
        
$html '<select id="display_number" onchange="toAjaxTableEditor(\'display_num_changed\',this.value);">';
        while(
$value $this->numResults && $value $this->maxDispNum)
        {
            
$value $value $this->displayNumInc;
            if(
$value == $this->displayNum)
            {
                
$html .= '<option value="'.$value.'" selected="selected">'.$value.'</option>';
            }
            else
            {
                
$html .= '<option value="'.$value.'">'.$value.'</option>';
            }
        }
        
$html .= '</select>';
        return 
$html;
    }
    
    function 
getPageDropDown()
    {
        
$pages = array();
        
$curPage round($this->start $this->displayNum);
        
$numPages ceil($this->numResults $this->displayNum);
        if(
$numPages == 0)
        {
            
$pages = array(0);
        }
        else if(
$numPages $this->showAll
        {
            
$pages range(1$numPages);
        } 
        else 
        {
            for(
$i 1$i <= $this->pageBegin$i++)
            {
                
$pages[] = $i;
            }
            for(
$i $numPages $this->pageEnd$i <= $numPages$i++)
            {
                
$pages[] = $i;
            }
            
$i $this->pageBegin;
            
$x $numPages $this->pageEnd;
            
$metBoundary false;
            while(
$i <= $x)
            {
                if(
$i >= ($curPage $this->pageRange) && $i <= ($curPage $this->pageRange)) 
                {
                    
$i++;
                    
$metBoundary true;
                } 
                else 
                {
                    
$i $i floor($numPages $this->pagePercent);
    
                    if (
$i > ($curPage $this->pageRange) && !$metBoundary)
                    {
                        
$i $curPage $this->pageRange;
                    }
                }
                if (
$i && $i <= $x
                {
                    
$pages[] = $i;
                }
            }
            
sort($pages);
            
$pages array_unique($pages);
        }
    
        
$html '<select id="page_number" onchange="toAjaxTableEditor(\'page_num_changed\',this.value);">';
        foreach(
$pages as $i)
        {
            
$value = ($i 1) * $this->displayNum;
            
$value $value $value;
            if((
$i 1) == $curPage)
            {
                
$html .= '<option value="'.$value.'" selected="selected" style="font-weight: bold">'.$i.'</option>';
            }
            else
            {
                
$html .= '<option value="'.$value.'">'.$i.'</option>';
            }
        }
        
$html .= '</select>';
        return 
$html;
    } 
Agradezco de antemano su ayuda !!