Ver Mensaje Individual
  #1  
Antiguo 05-06-2012
juanpy juanpy is offline
Miembro
NULL
 
Registrado: feb 2012
Ubicación: Santiago de Chile
Posts: 64
Reputación: 13
juanpy Va por buen camino
Question Delphi for Php, adaptar buscador incremental en grilla!!

Estimados,

Existe un algoritmo propuesto en Embarcadero que se supone realiza una busqueda incremental en una grilla.

Código PHP:
function  jsDBGfindtext(model,thetext,startingRow,column)
{  //zips thru a dbgrid to find something
     var rowCount = model.getRowCount();
     for(var row = startingRow; row < rowCount; row ++ )
            {            var desc = model.getValue(column,row);  
          if (typeof(desc)=="number") desc=desc.toString(); 
           if (typeof(thetext)=="number") thetext=thetext.toString();
            desc = desc.toUpperCase();
            thetext = thetext.toUpperCase();
            if ( desc.indexOf(thetext)>=0) return (row);
            }      return (-1);
   }//the calling routine from a basic edit   function EsearchdbgridJSKeyUp($sender, $params)
               {
               ?>                var lookfor = findObj('Esearchdbgrid').value;
                if (lookfor.length < 2) startRow = 0;
                if (lookfor.indexOf(' ',0)) //use space bar as a look for next occurrence.
                  {                  var look = lookfor.split(' ');
                  lookfor=look[0];
                  }
                if (typeof(startRow)=='undefined') startRow=-1;
                startRow++;
                startRow=jsDBGfindtext(dbgrid.getTableModel(),lookfor,startRow,4);
                if (startRow>-1)
                     {
                     dbgrid.setFocusedCell(5, startRow, true);
                     dbgrid.getSelectionModel().setSelectionInterval(startRow, startRow);
                     }
               <?php
               
}
Ahora, lo importante es adaptarlo a los eventos PHP o Java de una Text para que realice la funcion, alguien me puede orientar por favor.

Gracias.

Última edición por juanpy fecha: 05-06-2012 a las 21:19:20. Razón: Quedo mal tabulado
Responder Con Cita