WebTable

For questions about Gambas web tools.
Post Reply
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

WebTable

Post by BruceSteers »

Does anyone know how to fill a WebTable ?

Seems odd there's AddColumn and other column stuff yet no Row stuff at all ?

Any examples / advice welcome

Cheers
Bruce
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: WebTable

Post by BruceSteers »

It's okay i have the answer now...

It's all in the WebTable_Data() event
The Data event triggers for each cell in the table on refresh.

You add Rows by simply setting the .Count property
then handle everything in the Data event...

Something like this....

Public sFiles As String[]

  Public Sub WebForm1_Open()

  WebTable1.Columns.Count = 2
  WebTable1.Columns[0].Text = "Type"
  WebTable1.Columns[1].Text = "Name"

  sFiles = Dir("/readable_dir")

  WebTable1.Count = sFiles.Count

End

Public Sub WebTable1_Data(Row as Integer, Column As Integer, Data As WebTableData)

  Select Column
    Case 0
      Data.Text = if(IsDir("/readable_dir" &/ sFiles[Row]), "Dir", "File")
    Case 1
      Data.Text = sFiles[Row]
    End Select

End
If at first you don't succeed , try doing something differently.
BruceS
Post Reply