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
Avoid row being selected by default? printer friendly version
next newest post | next oldest post
Author Messages
jeff
Private

Gender: Male
Location:
Registered: Apr 2008
Status: Offline
Posts: 5

Click here to see the profile for jeff Send email to jeff Send private message to jeff Find more posts by jeff Edit or delete this message Reply w/Quote
Posted Monday, April 14, 2008 @ 20:57:57  

I've hunted around for an answer to this but couldn't seem to find anything relevant. I'm using multiple QuickTables on a page. Selecting a row in Table #1 causes Table #2 to requery based on the selected row ID in Table #1.

Question #1:

Each time Table #2 is refreshed, the first row is selected by default, and the first cell is also selected by default. When the first cell is a date field, the calendar automatically pops up but then actually is hidden behind the main panel.

Is there a way to ensure that when a table is refreshed NO row or cell is selected by default until a user selects one?

I've tried using dbTable.clearSelection() in various places in the sequence of events, to no avail. Is there some documentation that discusses which events get fired in what sequence?

Question #2:

If Table #2 depends on Table #1 for it's data via a row ID, is there a way to show Table #2 as a BLANK table with the appropriate column headings until a row in Table #1 is selected?

By the way, great work on designing QT. I was about 3/4 finished creating my own "DBTable" collection of classes that was functionally very much the same, struggling since I am returning to Java after using other technologies for a long time, when I found QT. The native Java data table classes are not very intuitive at all, so this is precisely what's needed.

Thanks,
Jeff

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 Monday, April 14, 2008 @ 21:25:11  

You can prevent the initial selection , by adding a DBTableEventListener to the DBtable.
addDBTableEventListener(DBTableEventListener yourListener)

In the event listener class listen for beforerowselectionchange event and return false for the method. This will prevent the selection from happening. once the refresh() is complete on the child table, you can return true for this method, so that users will be able to select the row.

public boolean beforeRowSelectionChange(int fromRow,
int toRow,
int fromColumn,
int toColumn)

Read API for more info.

jeff
Private

Gender: Male
Location:
Registered: Apr 2008
Status: Offline
Posts: 5

Click here to see the profile for jeff Send email to jeff Send private message to jeff Find more posts by jeff Edit or delete this message Reply w/Quote
Posted Monday, April 21, 2008 @ 19:14:07  

Thanks.

I've managed to avoid having the first row of a table be selected automatically, but the first cell in each table still appears "selected" such that it looks to have focus (but doesn't)--i.e. the cell is surrounded by an extra bold box, even when the row is not selected.

I imagine there's a workaround for this too, but along with the first row in a table being selected by default and the "extra bold" look of the box around selected cells, default cell selection doesn't seem to fit with the expected behavior of other Java or windowing components in general. For instance, in my aborted version of creating my own DBTable, without doing any programming to prevent it, no row was selected by default before a user actually selected it; also, in a frame containing multiple tables, only one cell in the selected table appears selected and has focus, all others loose focus and return to their normal appearance; and finally the selected cell is indicated subtly by a box that is only slightly darker blue than the selected row background. Additionally, a table "knew" when it hadn't been given any data yet or been told to execute a query, and it would just display itself as an empty table. It would be nice to have these be your defaults, since they match expected behavior.

I don't mean to complain, it's just that unless there's a reason to depart from the expected behavior (or look) of controls, doing so actually makes it more complicated for a programmer to get things back to expected behavior. These seemed like nice touches with the version I was working on (but admittedly don't have the knowledge yet to complete), and they might be good additions (subtractions?) to your DBTable.

Again, in general this is a very good tool.

Thanks,
Jeff

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, April 22, 2008 @ 03:11:04  

I agree with you. We will try to come up with some solution for this.
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