Hi Adnan,
I have corrected exactly the same scenario and "dataTable.setFirst(0)"
should definitely work.
Step 1: In ur Xhtml code do the binding for the scroller with ur managed
bean(CustomTreeNodePanel)
Eg:
<h:panelGrid columns="1" styleClass="scrollerTable2"
columnClasses="standardTable_ColumnCentered"
rendered="#{customTreeNodePanel.nodesCountToDisplay >
15}"> <!-- This 15 should be equal to the number of rows -->
<t:dataScroller id="scroll_1"
for="tree_data_models"
fastStep="5"
pageCountVar="pageCount"
pageIndexVar="pageIndex"
styleClass="scroller"
paginator="true"
paginatorMaxPages="7"
paginatorTableClass="paginator"
paginatorActiveColumnStyle="font-weight:bold;"
rendered="#{customTreeNodePanel != null}"
binding="#{customTreeNodePanel.scroll}">
Step 2: In managed bean define scroller and have getter setter
methods.(public)
Eg: private HtmlDataScroller scroll = new HtmlDataScroller();
Step 3 : Define method to reset scroll index
/**
* Resets the Scroller index to the given <code>index</code>
* @param index
*/
public void resetScrollerIndex(int index) {
if(getScroll() != null && getScroll().isPaginator()) {
getScroll().getUIData().setFirst(index);
}
}
Step 4: On second search call reset method resetScrollerIndex(0); with index
as zero.
This will definitely work :-). I had spent two days to fix this problem
Regards,
Kiran Singh K
On Thu, Aug 7, 2008 at 5:21 PM, adnan1146
<[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> wrote:
>
> I have implemented a t:dataTable with a t:dataScroller, the problem i am
> facing is that:
>
> If i search some data and go to 5th page using data scroller, now if i
> search again with different criteria,
> then the table is displyed with new result set but the data scroller is
> still showing the 5th page selected - which was selected in the previous
> search.
>
> I am using the tomahawk 1.1.5 dataTable binded to the bean property
> "HtmlDataTable htmlDataTable;"
>
> To fix this, i tried following solutions
>
> 1- by instantiating again like dataTable = new HTMLDataTable,
>
> Result == NOt working
>
>
>
> 2- I have included 'first' page attribute which is binded to a bean
> property, when ever I hit search button, the first page property is set to
> 0
> and the table is displayed on the next page. (My bean has a session scope,
> so searched data is available on the next page for data table)
>
>
> Result == My scroller stop working , and navigation it remains on first
> page
>
>
> This solution works well if i do not bind the data table
>
>
> 3- dataTable.setFirst(0)
>
> Result == NOt working
>
> Required :
> Please tell me some solution to reset the data scroller page index to first
> page, when ever i land from search criteria page to results page.
>
> Reset works If i add a command link on the results page where the dataTable
> is diplayed, and then in its action i execute dataTable.setFirst(0), but i
> cannot give reset link on the results page, i want to do this before page
> rendering.
>
> --
> View this message in context:
> http://www.nabble.com/tomahawk-t%3AdataTable-scroller-reset-tp18868709p18868709.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>