Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   PHP (https://www.clubdelphi.com/foros/forumdisplay.php?f=15)
-   -   Delphi for Php, adaptar buscador incremental en grilla!! (https://www.clubdelphi.com/foros/showthread.php?t=79066)

juanpy 05-06-2012 21:15:28

Delphi for Php, adaptar buscador incremental en grilla!!
 
:confused:
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.


La franja horaria es GMT +2. Ahora son las 15:35:45.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi