On Fri, Aug 7, 2009 at 10:45 AM, Lena Korshunova<[email protected]> wrote:
>
> Hello,
>
> I use polling for the table, but I do not need to poll all the time. So,
> after I get information I need, I disable polling by setting polling
> interval to a very big number. It works, but when I go to the next page of
> the table, I need to enable polling to get information for the new page. I
> tried to change polling interval, but it did not work. My jsp page is :
>
>                <tr:poll pollListener="#{accountBean.onPoll}" interval="1000"
> id="pollBalances"/>
>                <tr:table width="550" var="period" 
> partialTriggers="::pollBalances"
>                        value="#{accountBean.accountPeriodsCollectionModel}" 
> rows="25"
>                        horizontalGridVisible="false" 
> verticalGridVisible="true">
>                          ...
>                </tr:table>
>
> onPoll method where I disable polling is here:
>
>    public void onPoll(PollEvent event) {
>        //get information I need and update table data model
>                 ....
>        CorePoll pollingComponent = (CorePoll)event.getComponent();
>        pollingComponent.setInterval(10000000); //deactivate pooling, set to
> 2 hours
>
>    }
>
> listener method, which is called when next page of the table is loaded:
>
>    private class AccountPeriodRefreshCollectionListener implements
> RefreshCollectionListener {
>
>        public DataPage refreshCollection(List<SortCriterion> sortCriteria,
> int rangeStart, int rangeEnd) {
>            DataPage nextPage =
> accountingService.getAccountPeriods(getAccountId(), sortCriteria,
> rangeStart, rangeEnd);
>
>            pollingComponent.setInterval(1000); //try to enable polling, but
> it does not work
>       }
>   }
>
> Could you, please, help me with some advice if you know how to solve this
> problem?
>
> Thank you, Lena



quick question:

on your "listener" (after navigation, right?) have you added the poll-comp
to the partial target ?
=> RequestContext.getCurrentInstance().addPartialTarget(comp);

You may try to bind the interval number to a session scoped property;
so in onPoll() you just access that; and add the poll to the partial target;
after navigating your "listener" could just access the session scoped
property again;

-Matthias


> --
> View this message in context: 
> http://www.nabble.com/problem-with-disabling-polling-for-one-page-of-the-table-and-enabling-it-for-the-next-page-of-the-table-tp24861084p24861084.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Reply via email to