Here is the wiki page [1].

Feel free to let me know what you think, and of course further contributions to the wiki are appreciated.

[1] http://wiki.apache.org/myfaces/ManagingDataScrollerPage

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates

Jeff Bischoff wrote:
Titi,

This question is asked a lot, so I've decided to make a wiki page on it. You can expect that page up by the end of today, unless some disaster happens at work. Rather than make you wait, I'll give a quick version of my answer here.

I gave you a tip on this in another thread [1]. But what I left out is this last part: how to get the first attribute set.

There are two approaches, depending on your situation. If the data is being reloaded between requests, and the indexes thus may change, you will need to rely on some unique key in your data. Remembering the key of the selected item from the last request, you iterate through the new list until you find it, and then manually set the selectedIndex on the dataTable backing bean. This is why I do generally, in my application.

If you're not reloading your list, or if the ordering is such that the indexes won't change, you can cut through all this and use a neat little trick in your dataTable columns. Whichever column(s) have a commandLink to drill down to the detail page, add an extra t:updateActionListener:

<t:updateActionListener property="#{dataTableBacking.selectedRowIndex}" value="#{rowIndex}"/>

Where #{rowIndex} references the "rowIndexVar" we defined in our dataTable.

So

-----
<h:column>
  <f:facet name="header"><h:outputText value="ID:"/></f:facet>
  <h:commandLink action="#{navigation.drillDown}" immediate="true">
    <h:outputText value="#{data.id}"/>
<t:updateActionListener property="#{detailsBean.id}" value="#{data.id}"/>
  </h:commandLink>
</h:column>
------

Becomes

------
<h:column>
  <f:facet name="header"><h:outputText value="ID:"/></f:facet>
  <h:commandLink action="#{navigation.drillDown}" immediate="true">
    <h:outputText value="#{data.id}"/>
<t:updateActionListener property="#{detailsBean.id}" value="#{data.id}"/> <t:updateActionListener property="#{dataTableBacking.selectedRowIndex}" value="#{rowIndex}"/>
  </h:commandLink>
</h:column>
------



[1] http://www.nabble.com/Drill-Down-help-tf2275433.html#a6321951

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Titi Wangsa wrote:
i have a session backed list
which gets displayed in a t:dataTable

which works great..

then i use the scroller to display a few items in each page

which works great

however each item in the table can be clicks to
display the details of the item.

on these details page, there is link which points back to the listing page

but once i get back to the listing page, the first page is displayed.
which is not so great.

I've located the problem in the t:dataTable's "first" attribute,
but setting that value to first="#{listStudentst.first}", where
listStudent is a session backed bean, and first is an Integer, results
in the value gets read with the table is rendered.
Which is half of what i need.

The other half is for the table's first attribute to be saved in the
session backed bean.
Which is what is troubling me..
any help?










Reply via email to