You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Renzo Tomaselli <re...@tecnotp.it> on 2007/01/03 16:16:15 UTC

[Trinidad] selectedRowKeys usage

Hi, selection mechanism for tr:table works well, but I'm not able to get the
meaning of the selectedRowKeys attribute.  
I'd like to preselect some rows at rendering time. This seems to work well
automatically across requests, but I would like also to preselect at the very
beginning of component life. This is not shown in any demo or documentation.  
Well, I did place in tr:table:  
  
selectedRowKeys="#{resultBean.selection}"  
  
and in my bean:  
  
    public RowKeySet getSelection() {  
        RowKeySetImpl set = new RowKeySetImpl();  
        set.setCollectionModel(data);   // my CollectionModel  
        ArrayList<String> list = dataSource.getSelection();   // my current selection  
        for (String k: list)  
            set.add(k);  
        return set;  
    }  
  
but it doesn't work, and furthermore it disables selection storage across
requests. On the other hand - I miss the rationale of getting a selection this
way - since I might well grab the table component during any life step and
play with setSelectedRowKeys() on its own RowKeySet.  
So I miss how and why I should provide a foreign set to the selectRowKeys
attribute for preselecting.  
Any help ?  
Thanks -- Renzo