how to sort jtable with row groups
I am writing my first production application for work, it scrapes data from a telnet session and displays it in a jtable. The data displayed is call disposition statistics for individual agents in a market research center. It provides filtering by center location, and whether the agent is currently active on the project in question. The data displayed may be totals, averages, or percents, depending on the view mode.
I must now allow the table data to be printed, but the printout must contain three rows for each agent (total, ave, and percent), and three rows at the end with the totals for the job. The screen display code works fine (though i'm sure it could be done more elegantly)
I think that I can build a special table for printing (not displayed to the user) and just insert the extra rows for percent and ave, but I would like to have the data sorted by whichever column is currently sorted on the displayed table.
If I add the primary row (totals) for each user ( essentially duplicate the on screen table) and sort it, then go back and insert the ave and percent rows after each main row, will the model try to re-sort the table after each row insertion? Is there a better / simpler way to implement this?
The displayed table can and does change constantly, with a loop that updates the numbers, and adds and removes users as they become active and inactive.
Thanks for your advice,