The button reacts once even it gets clicked two or more times
I have 2 buttons doing the the iterating of a table, like Previous, Next.
It works fine if I click the button, e.g. Next, once, I got the next table row displayed.
However, when I click again the same button (previous clicked), Next, it seems like I just got the same page refreshed: I did not get the next table row displayed!
It seems to me when clicking the same button 2 or more times, the action is just activated once.
Any helps will be appreciated.
Thanks,
James
[516 byte] By [
jjwwanga] at [2007-11-27 11:08:08]

# 1
What appears to be happening is that the data provider is resetting the row key to point to the first row every time you click Next or Previous.
I think you should save the row key in a session bean.
If the action is for the Next key, use cursorNext() on the data provider to advance the cursor to the next row. Get the row key (that corresponds to the next row) from the data provider by calling getCursorRow and save it to a session bean.
In prerender, retrieve the row key and use the data provider's setCursorRow to place the cursor on the correct row.
Finally, refresh the data provider.
# 2
thanks a lot, John. - I fixed my problem by your hints.
The key was that the data provider resets the row key to the first row every time the page accessed. Saving the current rowkey to session bean fixes the problem.
thanks again,
James