EuGrid question
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Jul 21, 2003
- 432 views
I've started using EuGrid, and I want to be able to wipe out an entire grid (data and display). I'm displaying tables in a database, and the fields, size of the tables change, so it's easier to simply delete and restart whenever I want to display another table. There doesn't seem to be a good way to do this. Here's what I've done: -- wiping out a grid: cols = EGW_EnumCols( grid ) for i = 1 to length(cols) do void = EGW_DeleteCols( grid, cols[i] ) end for void = EGW_LoadData( grid, {}, EGW_REPLACE ) The catch is, EGW_LoadData() doesn't like it when you send an empty sequence, though this seems pretty obvious to me what should happen with EGW_REPLACE, right? So, I added this elsif block to EGW_LoadData(): if grid > 0 and rows > 0 then -- ... do lot's of stuff elsif grid > 0 and insert_position = EGW_REPLACE then -- data = {}, so delete the whole thing... GridData[grid] = data GridFlag[grid] = data GridCurrentCell[grid] = {-1,-1} end if The only alternative to this seems to be to use EGW_DeleteDataRow(), which would be severely inefficient. Of course, now I have a non-standard version of EuGrid. :( Is there a better way? Matt Lewis