You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bertrand Guay-Paquet <be...@step.polymtl.ca> on 2011/10/10 22:56:27 UTC

Retaining TextFilter cursor position on ajax update

Hello,

I am trying to use DataTable's FilterToolbar and friends to filter a 
table's contents. One of the columns is a string so I use the TextFilter 
class. However, I can't find how to properly integrate ajax with this.

I want the text field to submit the form when its input changes which 
triggers an ajax update of the table. I used an AjaxFormSubmitBehavior 
with the onkeyup. When the ajax update happens, the textfield of the 
TextFilter is also updated and the cursor position is lost (field focus 
however is restored through some built-in FilterForm javascript). Since 
the TextFilter is in a table header, I can't exclude it from the table 
ajax update.

Is there already a way to deal with this in Wicket? I would like to 
retain the text box state on the client side when the ajax update happens.

Some possible solutions:
-The textInput could be moved outside the table, but I'd like to avoid 
that for presentation reasons
-I could write javascript that attempts to find the cursor position 
before the ajax update and restores it afterward. I don't want to 
reinvent the wheel if a solution already exists.

Thanks for any suggestions,
Bertrand

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org