To increase performanse when inserting many rows at a time use setRowCount() instead of insertRow().
To increase performanse when inserting many rows at a time use setRowCount() instead of insertRow().
By looking to see if there was space in my table, and if there wasn't I used a setRowCount to add 10 more rows and then started adding the data until these 10 rows were done and then repeated. This greatly increased the speed! Is this what you meant?
ken
More or less
I ment that If you know how much data you want to add then setting row count in one go is very efficient. There's no need to do it in steps if you know how big the whole batch is.
Your approach is ok, just remember that after adding last item you need to check if there are any empty rows left and remove them (unless they don't bother you).
It would be even faster if you know the total number of rows in advance, instead of allocating them 10 at a time. Call setRowCount() once with the total count, and you're done.
If you don't now know the total in advance, then it would probably help a lot if you restructured your code so that you could determine the count first. Break it up so you retrieve your table data from wherever first, then pass the whole thing to the table. Sounds like you're retrieving data at the same time you are filling the table, which seems like an inappropriate mixing of two logically separate functions.
Bookmarks