craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > Column Post New Topic   Post A Reply
Is it possible to programatically set column positions printer friendly version
next newest post | next oldest post
Author Messages
ethnarch
Private

Gender: Unspecified
Location:
Registered: Oct 2006
Status: Offline
Posts: 3

Click here to see the profile for ethnarch Send email to ethnarch Send private message to ethnarch Find more posts by ethnarch Edit or delete this message Reply w/Quote
Posted Saturday, October 28, 2006 @ 07:26:30  

I want to do something like this

Column col = dBTable1.getColumnByHeaderName("somecolumn");
col.setValue(4);

The reason behind this is that say a user was drag the columns into a new position you could use dBTable1.getColumn(1) to save all of the positions and then next time they open the program reset them to the users previous settings.

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Tuesday, October 31, 2006 @ 16:56:11  

It is not possible to just set the column positions, but you can programatically move columns to different positions using dbTable.moveColumn(int column, int targetColumn)

Lets say originally columns are 1,2,3

user moved as 2,1,3

Then next time when you load the table,

dbTable.refresh();
dbTable.moveColumn(2,1);

timns
Unregistered
Edit or delete this message Reply w/Quote
Posted Saturday, November 24, 2007 @ 11:02:17  

That is a nightmare when you are working with a large number of columns. I think it would not be good for one's sanity to try to re-order a table using multiple calls to .moveColumn until the order matches the sequence that the user saved las time he ran your application.

There is a way that always works. After creating the table from your database, remove all the columns and then add them again in the order in which you want them. Be sure to preserve the model index and the column name! I've just been playing with this idea on an 18 column table and it seems to be just fine, but I'd be interested to hear from the developers if there are any pitfalls that I may have overlooked.

I can post some code if anyone is interested.

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios