Programmatically disable certain columns from being dragged

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

Programmatically disable certain columns from being dragged

Postby arazvi » Mon Oct 03, 2005 7:51 am

In normal Java there is a way to either enable/disable columns being dragged around the table.

But I have a situation, where I want to disallow dragging for the first column only and allow it for all the other columns.

Obviously the solution will have to prohibit dragging any column over to the first columns place.

Do any Jide components support this functionality ? If not, can it be added ?
arazvi
 
Posts: 27
Joined: Mon Sep 05, 2005 4:07 am

Postby JIDE Support » Mon Oct 03, 2005 8:21 am

It's not there in JIDE. However I can tell you how to do it.

You just need to create your own TableColumnModel that extends DefaultTableColumnModel. Set it to any JTable by overriding JTable#createDefaultColumnModel() method.

In your TableColumnModel, override moveColumn(int columnIndex, int newIndex). The columnIndex value is 0 (the first column is being moved), return. If newIndex is 0 (other columns are being moved before the first column), return. Otherwise, call super.moveColumn(...).

I haven't tried myself but please let me know if it works.

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

It works fine !

Postby arazvi » Tue Oct 04, 2005 7:27 am

Thanks !

Your solution worked a treat :D
arazvi
 
Posts: 27
Joined: Mon Sep 05, 2005 4:07 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 98 guests