Page 1 of 1

Actualizar los datos del un virtual GRID

Posted: Wed Sep 30, 2020 12:44 am
by mjaviergutierrez
hola, como actualizo los datos de un virtual grid ?

Re: Actualizar los datos del un virtual GRID

Posted: Wed Sep 30, 2020 1:17 am
by AUGE_OHR
hi,
mjaviergutierrez wrote: Wed Sep 30, 2020 12:44 am hola, como actualizo los datos de un virtual grid ?
after update Array call this

Code: Select all

PROCEDURE RefreshCurrent( cForm, cBrowse )
LOCAL hBrowse := GetControlHandle( cBrowse, cForm )
LOCAL nRecord := GetProperty( cForm, cBrowse, "VALUE" )
   ListView_RedrawItems( hBrowse, nRecord, nRecord )
RETURN

Re: Actualizar los datos del un virtual GRID

Posted: Wed Sep 30, 2020 10:30 pm
by mjaviergutierrez
Gracias amigo AUGE_OHR, saludos.

Re: Actualizar los datos del un virtual GRID

Posted: Thu Oct 01, 2020 6:31 am
by SALINETAS24
Y ya que estamos...,
¿en que se diferencia un GRID NORMAL cargado con un array, imaginemos de 1000 elementos y de un GRID VIRTUAL, que también carga un array de 1000 elementos?
Quedo agradecido de antemano por la aclaración....

Re: Actualizar los datos del un virtual GRID

Posted: Thu Oct 01, 2020 7:20 am
by AUGE_OHR
hi,

normal you have to load each Element using AddItem() ... this can take some Time :roll:

when already have a Array e.g. Directory() you need this

Code: Select all

   aDir := Directory()
   ...
   ITEMCOUNT LEN( aDir )
   VIRTUAL .T.
   ON QUERYDATA OnDataRequestStruct( aDir )
you do not have to use AddItem while Data are read "on-fly" when QUERYDATA Event ( LVN_GETDISPINFO ) is fired

Code: Select all

FUNCTION OnDataRequestStruct( aData )
LOCAL xVal
LOCAL nRow := This.QueryRowIndex
LOCAL nCol := This.Querycolindex
   IF .NOT. EMPTY( nRow ) .AND. nRow <= LEN( aData )
      xVal := aData[ nRow ] [ nCol ]
      This.QueryData := xVal
   ENDIF
RETURN .T.
FUNCTION OnData is like "DbSkipper" in TBrowse but much faster to display Data in GRID.