I’m writing a new app to archive messages. Users have a lot of messages which usually are not paginated. And everything is loaded into a htmlviewer. Because Xojo doesn’t have a listbox with variable listbox rowheights I need to use a htmlviewer anyways.
I’m not a web developer. What are my best options to get this done?
I’ve done some communication of the htmlviewer with javascript to Xojo. I would load the ids of the messages into the htmlviewer and then get the content of a message with javascript.
Are there other options? Is lazy loading better? If yes, how would lazy loading work?
I’m working with Valentina and have a cursor with data to load into the htmlviewer.
Assuming the messages for each line are about 100 chars or so, 100K * 100bytes. About 100Mb, It would be worth checking if the HTMLViewer can load that much data at all. I’ve seen issues with too much data causing issues / failing to complete loading.
My app generates statistical output on datasets. Given enough columns to analyse against each other, I ran into problems when the output file got large enough. The HTMLViewer.Load operation would progress and then fail, starting to load all over again.
You might want to use paginarion or load a chunk once user scrolls to bottom . You could however use another query to display a summary of this enormous archive at the top , which as a statistic might be of use
In any case.. 100k rows in any browser in HTML format is not an option
Yes, and the #1 mail client uses old-fashioned paginations Gmail
Outlook: Uses infinite scroll, but it’s actually a form of lazy loading. As the user scrolls, more messages are fetched in the background.
Apple Messages, WhatsApp, Telegram, etc.: All use some form of incremental loading, typically with virtualization and message window limits (e.g., load 50 before and after the current position, and unload distant ones from memory).
So, at lease use Lazy loading (Low memory usage, Fast initial load, No crash/hang from huge HTML content)
I’ve never used Xojo for web, but i’ve used HTMLViewer a lot, including with lazy loading. So I know you could approach it like this:
Initial load: Load the first n message IDs into the HTMLViewer. Render message summaries using HTML/JS.
Scroll detection: Use JavaScript to detect when the user scrolls near the bottom of the content.
Fetch more messages: JS notifies Xojo via (window.status for example) or similar method (ExecuteJavaScript + CancelLoad in the HTMLViewer).
Xojo response: Xojo loads the next chunk from sends it to the HTMLViewer.
Append to DOM: JS dynamically inserts new message summaries into the HTML content.
She would route a print function out of the htmlviewer control anyways, completely different process. And to add, the htmlviewer print method only prints what is visible in the control at any given time.
Surely that’s the problem. If you are trying to give the impression that the whole list is available.
Are you using the HTMLViewer because you want to use formatting or just for a table layout? I created a grid control that contains no data at all. It knows its bounds and how to display cells. It calls back to an event to retrieve a cell contents during painting. It can easily have 1.2 million rows in it, or even 800million. Unlike the listbox or HTMLViewer it never has any data loaded into it. Effectively the paint event asks what to show for a cell, draws it and then forgets it. Scroll bars allow you to change the top left cell etc.
Printing is already implemented. I do one pdf for the messages of a day. I only had to change the data over from my existing app Mail Archiver which already prints emails to pdf.
I need to use the htmlviewer for my app because I need a listbox with variable row heights. Also the data itself is really html. All links for instance are clearly rendered as html: