Is there an interface to get the “CellText” value of a WebListboxStyleRenderer returned through WebDataSource.RowData?
I’m only seeing the ability to get a String value from the WebListboxRowData.Value function. I can see an obvious format to the Xojo style renderer, and I can parse it; but this feels like something’s not right…
Is there an interface I’m missing or is this something I need to request for the framework?
Big picture context: I’m trying to write a function to take a WebDataSource and convert it to CSV for download. I use some monospace formatted cells through WebListboxStyleRenderer. I would like to be sure the CSV column is the “CellText” value and not the raw string that I’m currently seeing from WebListboxRowData.Value
Right. The DataSource returns strings because that’s what the listbox needs.
How are you implementing the DataSource? My immediate thought is to create an aggregate interface that has a method to get you csv data directly from the source using whatever the last sort order and filter was.
I wasn’t sure how to answer this, so I’ve built you a demo project with the design I’m using. I even included the monospace WebListboxStyleRenderer to work / play / demo with.
I would love for some guidance on this. I had a lot of trouble and wasn’t able to extract the runtime sort. I found that neither my data source reference nor the WebListbox.DataSource had updated the ColumnData array with the new sorts. It also lead me to notice #79654 - WebListbox has no SortingColumn property like Desktop does.
In the end I was able to extract the default sort from the ColumnData array, but it would be nice to have the runtime sort.
And it wouldn’t. When you’re using a DataSource, that’s all your responsibility.
What I was thinking of was when the RowData event fires, you could store the passed in sort data into a property that you can refer to later. So something like this…
Create a new interface and have the interface implement the WebDataSource interface.
Add a method signature for getting the CSV data as a WebFile.
Create a class for the DataSource and apply the interface created above to it.
Implement the methods, such that the rowdata method records the sort order to a private string property. If you’re allowing filtering, make that a property too.
In the csv method, query the DataSource again, using the sort property for the ORDER BY part of the statement. Iterate over the data and create the file, returning the webfile to the client.
Wherever you’re creating your listbox, create an instance of the class and make that the DataSource.
If you’re concerned about size, you could have the csv method start a webthread which notifies the session when it’s done compiling the data so the download can be started, but that’s a different, more elaborate answer.