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 > Events/Actions Post New Topic   Post A Reply
Row Selection event after refresh() printer friendly version
next newest post | next oldest post
Author Messages
sday
Private

Gender: Male
Location: Oregon
Registered: Jan 2012
Status: Offline
Posts: 1

Click here to see the profile for sday Send email to sday Send private message to sday Find more posts by sday Edit or delete this message Reply w/Quote
Posted Friday, January 20, 2012 @ 13:17:00  

I'm probably doing something wrong, but upon initial population of a table, I see the first row is selected by default. I would expect that to generate an afterRowSelectionChange event

Code:
public class MyTableEventListener extends DBTableEventListener {

public void afterRowSelectionChange(int fromRow, int toRow) {
System.out.println("Selected index="+toRow);
}
}

But it does not appear to do that. Now if I also attach a listener to the data model via:

Code:
 dbTable.getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() {

@Override
public void valueChanged(ListSelectionEvent listSelectionEvent) {
System.out.println("DM Selection listener() " + listSelectionEvent.getLastIndex());
}
} );

I do see the initial selection, but the data model listener seems very flaky and doesn't always report the row I am currently on. I'm not sure why as I'm new to Java and again it is probably something I am doing wrong.

Anyway, the above code for the DBTableEventListener appears to report all of my row selections properly, I just expected to receive an event when the first row is selected. I also tried to remove any default row selection, but was unable to figure out how to do that either, other than turning off row selection all together.

Thanks for any help,
-Steve

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 Thursday, February 9, 2012 @ 22:35:41  

I think this event is fired only when user changes the rows, not during refresh(). Again I might be wrong. A workaround would be to call rowselectionevent handler manually after refresh(). Source code is now open source, you can checkout.
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