Remove Rows in JIDE - Group Tbale

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Remove Rows in JIDE - Group Tbale

Postby uriweiner » Mon Apr 16, 2012 3:25 am

I’m using jidesoft.grid.DefaultGroupTableModel class wrapping swing.table.DefaultTableModel .

Problem is When I’m trying to remove a grouped row (DefaultGroupRow ) using the method jidesoft.grid.DefaultGroupTableModel.removeRow(row index) ,

The Row is removed visually only , and still exists in the swing.table.DefaultTableModel.

When i preform the groupAndRefresh method, the deleted row is re-created in the front end.

How can I remove the grouped table row that will be removed from the swing DefaultTableModel.

Thanks in advance.

Uri W.
uriweiner
 
Posts: 5
Joined: Mon Apr 16, 2012 3:12 am

Re: Remove Rows in JIDE - Group Tbale

Postby JIDE Support » Mon Apr 16, 2012 9:00 am

Please go through all rows in the original table model and invoke DefaultTableModel#removeRow() for all matching rows that meet the criteria of the DefaultGroupRow.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Remove Rows in JIDE - Group Tbale

Postby uriweiner » Tue Apr 17, 2012 12:25 am

Thanks for the Replay But my problem is:
how do i match the selected rows in the groupTableModle index with the Original modle rows index?
for ex. if user selected row 3 in the group table modle, how do i locate the row index in the Original modle so i will be able to delete it?
uriweiner
 
Posts: 5
Joined: Mon Apr 16, 2012 3:12 am

Re: Remove Rows in JIDE - Group Tbale

Postby JIDE Support » Tue Apr 17, 2012 11:42 am

Please invoke ((DefaultGroupRow) _table.getRowAt(3)).satisfies(originalModel, rowIndexInOriginalModel); to check if the row matchs the designated DefaultGroupRow.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Remove Rows in JIDE - Group Tbale

Postby uriweiner » Wed Apr 18, 2012 12:30 am

Thanks for the answer but it doesn’t answer my question.
The Question is:
if the row selected in the Group Table is 3 (row number 3 in the group table), how do i locate the Index of this row in the Original Table model.(for example it is row 7 in the original model)
(Do i use the method : getOriginalRows(3) or do you have a different method that will allow me to match :
Selected group table row index ----> to ---- > Original table model row index.

I’m looking for a method that will behave like:

orig_index = groupTableModel.(<methode that locates orig indexes for ex. >) (3)

then I’ll get that orig_index = 7.

Thanks for your support!

Uri
uriweiner
 
Posts: 5
Joined: Mon Apr 16, 2012 3:12 am

Re: Remove Rows in JIDE - Group Tbale

Postby JIDE Support » Wed Apr 18, 2012 8:53 am

If the row is a DefaultGroupRow, there might be many rows in your original table model that match the DefaultGroupRow. That's why you have to loop through all your rows in the original table model to check if those rows satisfy the conditions of the DefaultGroupRow. The API you are anticipating does not exist. The pseudo code to get all row indices is posted below FYI.
Code: Select all
List<Integer> matchingRowIndicies = new ArrayList<Integer>();
DefaultGroupRow groupRow = (DefaultGroupRow) _table.getRowAt(3);
for (int rowIndex = 0; rowIndex < originalModel.getRowCount(); rowIndex++) {
    if (groupRow.satisfies(originalModel, rowIndex)) {
        matchingRowIndicies.add(rowIndex);
    }
}

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 9 guests

cron