WebListbox woes, (row column limitations?)

About a year ago I put aside a project to convert one of my Web 1 apps to Web 2. I was attempting to integrate more than 1 app into a single application at the time. Recently it became necessary to revisit that project and eliminate the multi app configuration and trim it down to just 1 app for Web 2 conversion. That one was mostly complete and it didn’t take long to complete it. However testing has revealed that there is a problem with a reports page using a WebListbox to display large number of records in 24 columns. Two of those columns I have to use a WebListBoxStyleRenderer for word wrap because the database field can contain rather lengthy text. The issue I have encountered is that regardless of whether I use the WebListBoxStyleRenderer, If the number of rows to be displayed are somewhere north of 800, then the data never gets displayed. If I reduce the data to be displayed by limiting the query to a date range or some other filter so the number of rows is 800 or less it works as expected.

Seaching through the forum it appears there may be some bug/limitation in regards to a large number of columns and rows in the Web 2 Listbox and I have seen recommendations to use a WebDataSource instead. I haven’t tried this yet mostly because I can’t figure out how to use WebListBoxStyleRenderer with the WebDataSource example or if it is even possible to use WebListBoxStyleRenderer with a WebDataSource. I’m hoping the forum hive mind has some experience on taking the WebDataSource approach using a MySQL database. Currently I query the database and put the rowset into a 2 dimensional array so can process the data as I populate the Listbox formatting the two word wrap columns and changing boolean fields from 0/1 to Yes/No.

If anyone has any sage advice on tackling this problem with a WebDataSource or some way to work around what appears to be a bug in the WebListbox Thanks in advance. (For various reasons I would like to stick with the WebListbox for consistent aesthetic reasons rather than a 3rd party control if at all possible.)

WebDataSource can definitely help, and it does support WebListboxCellRenderers. It won’t display 800 rows at once. Instead, it will be gradually asking you to return an array of WebListboxRowData, while the user is scrolling.

Private Function RowData(RowCount as Integer, RowOffset as Integer, SortColumns as String) As WebListboxRowData()
  // Part of the WebDataSource interface.
  
  Var result() As WebListBoxRowData
  
  Var style As New WebStyle
  style.Bold = True
  
  // This part probably will be inside a loop, after querying the DB
  Var row As New WebListBoxRowData
  row.Value("someColumnName", "Some text")
  row.Value("anotherColumn", New WebListBoxStyleRenderer(style, "Styled text"))
  result.Add(row)

  Return result
End Function

Edit: There is an example under Platforms > Web > Listbox > Listbox with a Datasource.

Hi @Ricardo_Cruz, I already have the example file and will play with it to see if I run into any issues using it with MySQL and styling instead of SQLite. It’s good to know it will work with WebListBoxStyleRenderer. I may have more questions as I play with using WebDataSource.

Any chance you can explain why the WebListbox craps out with a large number of columns and rows?

Shout if you need any help! =)

Can you open the Browser console and see if there is any error there?

Oh, How about using multiple styles on a cell? Currently I have a method:

Public Function StyleCellTextWrap(celltext As String) As WebListBoxStyleRenderer
  // Usage: [ListBox].CellTextAt([ListBox].LastAddedRowIndex,[Column]) = StyleCellTextWrap([String])
    Var style as New WebStyle
  style.value("white-space") = "normal"
  style.value("word-wrap") = "break-word"
  Var cellrenderer as New WebListBoxStyleRenderer(style,celltext)
  Return cellrenderer
End Function

Can I use this by calling it like:

 row.Value("someColumnName", StyleCellTextWrap("Some text"))

Yes, you can reuse that method :+1:

Interestingly enough, when I right clicked on the WebListbox that wasn’t displaying data and chose “Inspect” it started displaying data. Eventually all the data queried displayed and when I closed the inspection window it repainted and the data was there. It has never displayed anything on the large query containing around 1400 rows before doing that.

That sounds like a race condition. I couldn’t replicate it with 1000s rows and 30 columns. Do you mind opening a new Issue with an example so I can take a better look?

OK give me a day or so to try to come up with an example

1 Like