| Author |
How should I handle a deleted record at GUI level
|
Anayonkar Shivalkar
Bartender
Joined: Dec 08, 2010
Posts: 1295
|
|
Hi,
Since I'm not reusing deleted record numbers, and I don't want to refresh data object cache again and again, what I'm doing is:
1) When a record is deleted, simply modify a flag
2) Never use that record number
However, at GUI level, how should I handle it?
e.g. If I removed 1st record, then when a user wants to read all records, the first record in result table is actually record number 2. So, how to map this? When user 'books' a record, he/she will simply provide new data for a record. So which approach should I follow?
1) Add a recNo field in data object. This field will be set while retrieving the record and will be referred for further operations. I'll also show this recNo in display table (though it will look a little weird if user see first record with recNo 2 - in case 1st record is deleted)
2) Since 'delete' is not a 'must' requirement, I simply won't care about this (and assume that first record is recNo 1 and so on)
I personally think that I should still go for 1st approach (since 'assumption' might be risky). Any suggestions?
|
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD)
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4355
|
|
|
I added a recNo field in data object, but didn't display it in the table, because that's internal information, no added value for the user (can only confuse him).
|
SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
|
 |
Sean Keane
Ranch Hand
Joined: Nov 03, 2010
Posts: 581
|
|
Roel De Nijs wrote:I added a recNo field in data object, but didn't display it in the table, because that's internal information, no added value for the user (can only confuse him).
I took this approach too!
|
SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
|
 |
Oladeji Oluwasayo
Ranch Hand
Joined: Sep 10, 2010
Posts: 99
|
|
|
I didn't include a recNo in the data object but the record numbers (from the database) is displayed in the GUI, this allows me to code the logic that gets the actual selected record using the table model's getValueOf(row, 0). I also provided a filter in the GUI to remove deleted records from the table model.
|
OCPJP 6, OCMJD 6
|
 |
 |
|
|
subject: How should I handle a deleted record at GUI level
|
|
|