Select Columns of multiple Tables

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Select Columns of multiple Tables

Postby gokulanand » Wed Oct 12, 2011 8:07 am

Hello Team,

I have a requirement where I combine 3 tables to show it as a single table. Which means Table 1 have a header and the other two tables doesnt have headers. Now the issue is, when I click on the header of the first table, the same column has to selected on all three tables.

I added my own implementation of mouseListener to my header. Here is the code snippet which is there within mouseClicked()

tableList is the ArrayList that contains list of tables. Table1 will be always there in the zeroth position of the list, which means tableList(0) will always have the table header.

public void mouseClicked(MouseEvent e)
{
for ( JTable table : tableList ) {
JTableHeader header = tableList.get(0).getTableHeader();

int column = header.columnAtPoint(e.getPoint());

int count = table.getRowCount();

if (count != 0) {
table.clearSelection();
table.setColumnSelectionInterval( column, column);
table.setRowSelectionInterval(0, count - 1);
}
}
}

I get the control within this function when I click the header, and also I do get the column position where I click. But I am unable to select the columns from different table.

Any help is highly appreciated.
Thanks
Gokul
gokulanand
 
Posts: 6
Joined: Fri Apr 29, 2011 4:11 am

Re: Select Columns of multiple Tables

Postby JIDE Support » Wed Oct 12, 2011 10:20 am

Have you invoked JTable#setColumnSelectionAllowed() for those tables? I can't see any suspicious code from what you have posted. We are happy to help if you could send us a stand-alone test case although the question is not quite related to JIDE products.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Select Columns of multiple Tables

Postby gokulanand » Thu Oct 13, 2011 1:41 am

Thanks mate,

JTable#setColumnSelectionAllowed() - setting it to "true" worked. In the snippet I provided the JTable, but the actual implementation was on JideTable. Anyways thanks for your time and help.

Gokul
gokulanand
 
Posts: 6
Joined: Fri Apr 29, 2011 4:11 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 14 guests

cron