-
1. Re: Using the rich:extendedDataTable selection attribute
nbelaevski Feb 23, 2009 6:10 AM (in response to firas_abah)Hello,
SimpleSelection contains set of row key objects corresponding to item model index. Here is the example of converting keys to model objects: http://livedemo.exadel.com/richfaces-demo/richfaces/scrollableDataTable.jsf?c=scrollableDataTable&tab=usage
http://fisheye.jboss.org/browse/RichFaces/trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java?r=11866 -
2. Re: Using the rich:extendedDataTable selection attribute
firas_abah Feb 24, 2009 3:38 AM (in response to firas_abah)Thanks a lot nbelaevski,
The following does it for me:private Employee getSelectedEmployee() { Iterator<Object> iterator = getSelection().getKeys(); while (iterator.hasNext()){ Integer key = (Integer) iterator.next(); return (Employee) getList().get(key); } return null; }
Not sure if it was safe to make that Object to Integer cast for the selection key!
Anyone can describe how 'key' works?
Regards, -
3. Re: Using the rich:extendedDataTable selection attribute
nbelaevski Feb 24, 2009 11:03 AM (in response to firas_abah)Keys are created by data model in order to serve as data model items locator. When iteration component is rendered or submitted, keys are used to identify data iterator position.
You can use your own data model generating its own keys, but for the case of built-in data table models, model keys are Integer. -
4. Re: Using the rich:extendedDataTable selection attribute
firas_abah Feb 25, 2009 12:30 AM (in response to firas_abah)Dear nbelaevski,
Thanks a lot for being very helpful again.
Best Regards,
Firas