Weblistbox limitation

Is there any limitation in the number of rows that can be loaded to a weblistbox from a rowset? The rowset comes from a Postgresql database with 2400 records. If I limit the selection of records to lets say 1000, it works but 2000 or more are never loaded without any error message from the database.

Var sql As String
sql = "SELECT * FROM covid ORDER BY fecha_diagnostico"

Var rs As RowSet
Try
  rs = Session.DB.SelectSQL(sql)
Catch error As DatabaseException
  MessageBox("DB Error: " + error.Message)
  Return
End Try


If rs Is Nil Then Return


MessageBox  "tiene " + rs.RowCount.ToString + " filas y " + rs.ColumnCount.ToString + " columnas"

// remover todas las filas
Listbox1.RemoveAllRows

// Añadir las columnas de la base de datos como los headers del listbox
Listbox1.ColumnCount = rs.ColumnCount


For i As Integer = 0 To rs.LastColumnIndex
  Listbox1.HeaderAt(i) = rs.ColumnAt(i).Name
Next




//Añadir la data desde la tabla
While Not rs.AfterLastRow
  Listbox1.AddRow("")
  
  For i As Integer = 0 To rs.LastColumnIndex
    Listbox1.CellTextAt(Listbox1.LastAddedRowIndex, i) = rs.ColumnAt(i).StringValue
  Next
  
  rs.MoveToNextRow
Wend

There shouldn’t be a limit as the web server keeps the full list of 2400 and passes them down to the browser as you scroll.

Thanks. It is a web application hosted in Xojo Cloud. That was the behavior until a week ago when it started to freezes.

I just tested by running in the IDE. It takes 4 seconds for the page to display. But it works.

Apart from that, as @David_Cox stated, the lines are loaded as needed when the user scrolls.

If @Juan_Carlos_Alcedo_Velarde is using Web 2.0.

Yes. It is Web 2.0

Thanks. Here even after 3 min, it is not working.

Limiting to less than 10 columns, it worked again. More than 10 (18 to be specific), it freezes again.

If you want to display a large amount of data, it will be better to use a WebDataSource.

Without it, the server will have to maintain everything in memory, and you may reach a limit there.

Using a WebDataSource, as you scroll, your data source will ask more rows to the database as needed.

If only a proper code example would be available…

1 Like

It’s lacking there, also the ways you need to handle the data are much to complex for a simple listbox.

Thanks. That worked but is very difficult to use the SelectionChanged event of the Listbox to retrieve specific pieces of information from the selected row

Also be aware of this:

https://tracker.xojo.com/xojoinc/xojo/-/issues/68611