hello paul,
does sorting work without your additional logic?
did you already consider to move your logic into the setter of your
component binding?
if you always preselect the first row something like this will also work:
public void setTable(UIXTable table)
{
RowKeySet rowKeySet = table.getSelectedRowKeys();
if (rowKeySet == null)
{
rowKeySet = new RowKeySetImpl();
}
if(rowKeySet.size() == 0)
{
rowKeySet.add( 0 );
table.setSelectedRowKeys( rowKeySet );
}
this.table = table;
}
within the page:
<tr:table rowSelection="single" binding="#{pageBean.table}"
...>...</tr:table>
if this doesn't work please try my config...
(trinidad 1.0.3 and myfaces 1.1.5/1.1.6-SNAPSHOT - this config worked very
well)
regards,
gerhard
2007/11/9, Paul Mander <[EMAIL PROTECTED]>:
>
>
> I am pre selecting the first row of a single selection table when it first
> gets created. I do this by defining the table as:
>
> <tr:table rowSelection="#{bean.rowSelection}" ...
>
> in the bean, the method getRowSelection is implemented as:
>
> public String getRowSelection() {
> if (getCoreTable() != null) {
> RowKeySet rowKeySet =
> getCoreTable().getSelectedRowKeys();
> if (rowKeySet.isEmpty() &&
> getCoreTable().getRowCount() > 0) {
>
>
> getCoreTable().setRowIndex(getCoreTable().getFirst());
> rowKeySet.add(getCoreTable().getRowKey());
>
> getCoreTable().setSelectedRowKeys(rowKeySet);
> }
> }
> return "single";
> }
>
> This works fine for me but if I set any of my tr:columns to be sortable,
> clicking on the columns does not do anything. The columns get rendered
> like
> sortable columns but you do not see any up/down arrow when you click on
> them.
>
> I'm using trinidad 1.0.2 and myfaces 1.1.4
> --
> View this message in context:
> http://www.nabble.com/-Trinidad--table-sorting-not-working-with-programatically-selected-row-tf4778207.html#a13668745
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces