WebTable

For questions about Gambas web tools.
Post Reply
BruceSteers
Posts: 841
Joined: Thursday 23rd July 2020 5:20pm

WebTable

Post by BruceSteers » Wednesday 20th July 2022 7:30pm

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

BruceSteers
Posts: 841
Joined: Thursday 23rd July 2020 5:20pm

Re: WebTable

Post by BruceSteers » Thursday 21st July 2022 1:50pm

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

Post Reply