Page 1 of 1

Grid QueryData from Dbf

Posted: Mon Jan 27, 2014 4:53 am
by hmgchang
Dear Sirs,

1. I looked into the Grid sample and can not understand how the querydata works on tables. Any sample ?
2. How to sort/index Grid columns ? ( on a ColumnHeaderClick)

thks n rgds
Chang

Re: Grid QueryData from Dbf

Posted: Mon Jan 27, 2014 9:03 pm
by Javier Tovar
Hello

This is an example to Browse, but it is not difficult to change a Grid, you have to do is identify the column or column header where you make Click, then delete all that this is the Grid, change of index with respect to the Click column where you made and do a Refresh on the Grid.

Code: Select all

*-----------------------------------------------------------------ORDENA POR CLICK EN CABECERA DE COLUMNA----------------------------------------------------
PROCEDURE Ordenar(nCol)
LOCAL nIndice := nCol
LOCAL cIndice 
LOCAL cCadena :=''
LOCAL Ficher  := Alias()
LOCAL cCampo  := ALLTRIM(aCampos[nCol])
LOCAL nPos    := PosiArray(aIndices , cCampo)
LOCAL n
LOCAL i

IF aTipos[nCol]== 'M'
   MsgBox('Este campo no se puede ordenar') 
   RETURN NIL
ENDIF

i:=0
FOR n:=1 TO nCol
   IF aTipos[n] == 'M'
      i:= i+1
   ENDIF
NEXT n

cIndice := 'I' + aIndices[nCol-i]

IF nPos != 0
   For n:= 1 TO FCOUNT()
      PantFiltros.Browse_1.HeaderImages(n) := ccDirRes+'Vacio.bmp'
   NEXT n
   
   PantFiltros.Browse_1.HeaderImages(nCol) := ccDirRes+'Up.bmp'
   cCadena:= Ficher+"->(ORDSETFOCUS('"+cIndice+"'))"
   &cCadena

   GO TOP
   PantFiltros.Browse_1.Refresh
   PantFiltros.Browse_1.SetFocus
ENDIF

RETURN NIL
Saludos

Re: Grid QueryData from Dbf

Posted: Mon Feb 03, 2014 4:18 am
by hmgchang
Thks Bro... I will try...