Skip to main content

new binding JXtable/Filter/Sorter problem

No replies
Joined: 2005-08-27

It appears that the New Binding for JXTable does not handle Sorters/Filters correctly.

I can find no view/model row conversion.

I have developed a patch if anyone is interested.
Changes are quite minor

In JTableBinding
a) add new method

<br />
    protected int getModelRow(int viewRow) {<br />
        // for JTable rows are the same<br />
        return viewRow;<br />
    }<br />

b) change doInitialize
<br />
//                      rows.add(getDataModel().getRow(indices[i]));<br />
                        rows.add(getDataModel().getRow(getModelRow(indices[i])));<br />

In JXTableBinding, add the new method

<br />
    protected int getModelRow(int viewRow) {<br />
        JXTable table = (JXTable)super.getComponent();<br />
        return table.getFilters().convertRowIndexToModel(viewRow);<br />
    }<br />

'table' could probably be made an instance field, as it's being read in doInitialize but ignored

It seems a minor fix, but its working for now.
If this is all thats required, the new structure is very sound
Haven't done extensive testing
Minor updating seems to work.
Haven't tried adding rows yet