Article View: borland.public.jbuilder.java.swing
Article #9600Re: hide rows in JTable?
From: John P. McGrath
Date: Sun, 05 Mar 2000 00:00
Date: Sun, 05 Mar 2000 00:00
31 lines
1879 bytes
1879 bytes
On 04 Mar 2000 15:55:16 +0100, Tor Iver Wilhelmsen wrote: > "Trey Ethridge" <ethridgt@earthlink.net> writes: > > > How would you suggest to actually hide the rows? I'm not sure > > how the TableModel can "hide" the rows from the jTable. Do you > > mean that the new TableModel will have another copy of the data > > inside it that only has the rows that I want to show? > > Just let getRowCount() and getValueAt() "skip" the rows you don't > want displayed. Those two are all you need to change if everything is guaranteed to be static. But if the data can change, the job gets more complicated. First you have to handle mapping of filtered row numbers to unfiltered row numbers in the the setValueAt() and isCellEditable() methods. But you also need to listen for changes in the underlying table model, map the unfiltered row numbers to filtered row numbers, and fire table model events with the filtered row numbers. Of course you will have to ignore events that only describe changes to filtered rows. Another issue to consider is that a change in the underlying table model may change the filtering criteria. So an UPDATE event could turn into a DELETE event, an INSERT event, or a combination of all three. -- John P. McGrath <JPMcGrath@fast.net> <jpm@nscs.fast.net>
Technical Details
Message-ID:
<MPG.132befc0c63e2db9897d9@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38B969F1.FC38DF02@db.erau.edu> <MPG.13236cbbe6eb6d2a9897c7@forums.borland.com> <89qbui$r9s4@bornews.borland.com> <uk8jizsx7.fsf@sds.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,8e0f666ae34fba12 X-Google-Attributes: gid111d45,public From: John P. McGrath <JPMcGrath@fast.net> Subject: Re: hide rows in JTable? Date: 2000/03/05 Message-ID: <MPG.132befc0c63e2db9897d9@forums.borland.com> X-Deja-AN: 593355203 References: <38B969F1.FC38DF02@db.erau.edu> <MPG.13236cbbe6eb6d2a9897c7@forums.borland.com> <89qbui$r9s4@bornews.borland.com> <uk8jizsx7.fsf@sds.no> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.swing