Page 2 of 2
Re: Cargar array en Grid
Posted: Fri Feb 26, 2021 10:14 pm
by Claudio Ricardo
Hola...
Si el array es multidimensional y coincide el número de campos con las columnas del grid, podrías probar así:
Code: Select all
If Len (aArray) > 0
For i = 1 To Len (aArray)
DoMethod ("Form_X" , "Grid_X" , "AddItem" , aArray [i] )
Next
DoMethod ("Form_X" , "Grid_X" , "Refresh")
DoMethod ("Form_X" , "Grid_X" , "SetFocus") // si quiero dejar el foco en el grid //
EndIf
A mi me funciona perfecto de este modo...
Re: Cargar array en Grid
Posted: Fri Feb 26, 2021 10:28 pm
by Claudio Ricardo
Si lo que deseas es limpiar el grid y luego cargarle datos nuevos:
Code: Select all
If Len (aArray) > 0
DoMethod ("Form_X" , "Grid_X" , "DeleteAllItems")
For i = 1 To Len (aArray)
DoMethod ("Form_X" , "Grid_X" , "AddItem" , aArray [i] )
Next
DoMethod ("Form_X" , "Grid_X" , "SetFocus") // si quiero dejar el foco en el grid //
EndIf
Re: Cargar array en Grid
Posted: Mon Mar 01, 2021 3:04 pm
by jparada
Hola,
Ahora funciona correctamente, gracias a todos que me están ayudando a avanzar en especial a Martín, Claudio y Jimmy.
Saludos,
Javier
Re: Cargar array en Grid
Posted: Mon Mar 01, 2021 5:20 pm
by mol
por que no usas VIRTUAL GRID? Esto es muy facil
Re: Cargar array en Grid
Posted: Mon Mar 01, 2021 9:07 pm
by jparada
Hi mol,
Honestly I have never worked with the grid more than representing data that comes from an array and that's all, I don't know what advantages or disadvantages have working with a virtual grid, or even if the syntax is fully supported.
Regards,
Javier
Re: Cargar array en Grid
Posted: Mon Mar 01, 2021 10:32 pm
by mol
Sorry for my bad Spanish .
Virtual grid is really easy to use. You don't spend time to load data by adding rows.
You don't duplicate resource usage because data presented by grid is still only in your array
Re: Cargar array en Grid
Posted: Tue Mar 02, 2021 9:25 pm
by Claudio Ricardo
Marek:
Your answer is well written in Spanish ...
I never used virtual grid but following your advice I will try it in my new project!
Thanks!