Implement your own CollectionModel class (e. g. MySortableModel extends
SortableModel) with getRowKey() and setRowKey(Object) methods e. g. like the
following:

        @Override
        public Object getRowKey() {
                return isRowAvailable() ? getRowData() : null;
        }

        @Override
        public void setRowKey(final Object key) {
                if (key == null) {
                        setRowIndex(-1);
                        return;
                }
                for (int i = 0; i < getRowCount(); i++) {
                        setRowIndex(i);
                        if (getRowData().equals(key)) {
                                break;
                        }
                }
        }

Then instantiate this MySortableModel and provide the tr:table sortableModel
attribute with this instance.


Glen wrote:
> 
> Design : Trinidad table component with attribute rowselection=multiple.
> Functionality: Delete a selected row after sorting any column.
> Logic/Implemention: Getting RowData for the selected rowKeySet using 
> table.getRowData(Integer.parseInt(selectedRowKeys.next().toString())) 
> Issue: Here getting a different value for the selectedRowKeys.next() ,
> rather than the selected row.
> Observation: After sorting, rows data are getting sorted but the row keys
> (table index) remains in the same order (0,1,2,3...) where we are using
> for deleting the selected rows.
> 
> Please Provide the solution for the above issue. 
> Or any alternative for deleting a table row with Rowselection=multiple
> 
> Thank You
> 

-- 
View this message in context: 
http://www.nabble.com/-Trinidad--Not-able-to-delete-a-record-after-sorting-the-table-column-tp25781833p25783147.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to