在richface datatable中关于指定某行作为当前行,有两种情况要处理:分页和不分页。
1、在richface datatable控件中有first属性, 如果没有分页, 设置first属性即可。
<rich:dataTable
id="idTable" first="#{currentPage.firstRow}"
rows="#{currentUserRecordsPerPage}" ...>
2、在有分页的情况下,不能指定datatable控件的first属性,必须先定位到那页即指定richface datascroller控件page属性,如page="#{currentPage.firstPage}" ,然后在后台中初始化这个变量,如:currentPage.firstPage=the current row/ records count of page + 1,page属性不能给公式,必须是变量,因为在换页时会赋值给这个变量。定位到某行时,就可以在dataModel中通过条件查找到那行对应的对象,然后设置标记。
<rich:dataScroller for="idTable" id="idDataScriller" status="sProgress" page="#{currentPage.firstPage}"
/>
本文介绍了在 RichFaces 的 DataTable 控件中如何指定某行为当前行的方法,包括不分页和分页两种情况下的实现方式。
4274

被折叠的 条评论
为什么被折叠?



