user1428051
user1428051

Reputation: 3

Java Wicket - Calling javascript ( JQuery ) before AJAX

I got this thing i'm trying to solve: I got a ListView created using Wicket ( 1.5 ) with a lot of elements and a scroll. When new items are available, the user is asked if he would like to refresh the list via a message backed by an AjaxLink:

public void onClick(AjaxRequestTarget ajaxTarget) {
  /* do something ... */                    
  ajaxTarget.addComponent(_list);
}

So on click the list gets reloaded and the scroll position is reset to zero. Is there any way i can call JavaScript before the list reloads the save the scroll position?

(I know how to get/save the scroll position ( .scrollTop() ) , i just don't know how to call a function right before AJAX ).

Upvotes: 0

Views: 1744

Answers (1)

Cedric Gatay
Cedric Gatay

Reputation: 1583

Have a look at the AjaxCallDecorator class to decorate the script before and after the ajax call.

You can have a look at my answer there : https://stackoverflow.com/a/10499868/722952

Upvotes: 1

Related Questions