Hi,
i'm trying to select a row in a table programatically.
I wrote follwing method to to that:
----------------------------------------
public static void selectDatas( CoreTable pCoreTable, Object... pDatas )
{
Object tCurrent = pCoreTable.getRowKey();
RowKeySet tRowKeySet = pCoreTable.getSelectedRowKeys();
tRowKeySet.clear();
for ( int i = 0; i < pCoreTable.getRowCount(); i++ )
{
pCoreTable.setRowIndex( i );
Object tRowData = pCoreTable.getRowData();
for ( Object tObjectToSelect : pDatas )
{
if ( tRowData == tObjectToSelect || tRowData.equals(
tObjectToSelect ) )
{
tRowKeySet.setContained( true );
}
}
}
pCoreTable.setSelectedRowKeys( tRowKeySet );
pCoreTable.setRowKey( tCurrent );
}
----------------------------------------
This works fine, but i don't know where to execute this method. I have
bound the table to my backing bean and tried to select the rows in the
getTable method. This works aside from the first row.
The Problem is, that the table model is added to table after the first
access to the getTable method and my code does not work without the model
in the table.
Any ideas or better solution ?
Thanks,
David
--
David Uebelacker
mailto:[EMAIL PROTECTED]
http://david.uebelacker.eu/