Results 1 to 4 of 4
Thread: Delete Button
- 10-22-2008, 05:38 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 1
- Rep Power
- 0
Delete Button
Hi I have added a delete button to my table
the goal is that when i click on it, it deletes the row
my buttonTableDelete_action() is as follow:
But this does not work... it deletes instead the first row on the column...Java Code:RowKey[] selectedRowKeys = getTableRowGroup2().getRowKeys(); Users[] users = getSessionBean1().getUsers(); int rowId = Integer.parseInt(selectedRowKeys[0].getRowId()); Users user = users[rowId]; // Remove the Entity from the database using UserController UserController userController = new UserController(); userController.removeUser(user);
any idea why ?
- 10-22-2008, 07:24 PM #2
Just another cross poster.
New To Java - Delete Button
db
edit And
Nabble - Netbeans - J2EE - Delete ButtonLast edited by DarrylBurke; 10-22-2008 at 07:41 PM.
- 10-26-2008, 07:48 AM #3
Member
- Join Date
- Oct 2008
- Posts
- 1
- Rep Power
- 0
Hello Zoro,
Please confirm yourself whether selectedRowKeys fetching only the selected row key or all the row keys in the datatable,
If it fetches all the row keys in the datatable then it always deletes the first row only,
because in the following line code
int rowId = Integer.parseInt(selectedRowKeys[0].getRowId());
you have hardcoded "0" and always getting the first rowkey as selectedRowKeys[0] returns the first object.
Please let me know if that works fine or not
- 10-26-2008, 02:45 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I think you wants to delete a row of a database. So why don't you use a query to do this.
Similar Threads
-
Delete
By Sarinam in forum New To JavaReplies: 6Last Post: 07-23-2008, 11:09 AM -
Delete From .txt file
By Sarinam in forum New To JavaReplies: 86Last Post: 06-28-2008, 10:17 AM -
delete string in JtextArea
By cloudet in forum AWT / SwingReplies: 3Last Post: 05-05-2008, 10:06 AM -
Listbox Add/Delete
By Rageagainst20 in forum New To JavaReplies: 2Last Post: 04-16-2008, 04:49 PM -
How to delete a file
By Alpha in forum New To JavaReplies: 1Last Post: 05-26-2007, 08:11 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks