How to reload sj: tab in struts2-jquery 3.3.3?

I need to reinstall the sj: tab in struts2-jquery 3.3.3, so far I have tried:

  • Add listenTopic tab for sj: does not work as I read that it was not implemented in this version yet
  • For any event, reload the tab as follows:

$ ('# myPanel'). tabs ("load", "#myTab");

It works and reboots, but some additional event handlers bind, and when I send via sj: submit, it sends two times, I tried to remove all event handlers with jquery before rebooting, but I don't mean anything. Thus, event handlers grow exponentially:

> $('#myPanel').tabs("load", "#myTab");  
1 event handler per button 
> $('#myPanel').tabs("load", "#myTab");
2 
> $('#myPanel').tabs("load", "#myTab"); 
4 .. 16 .. 32

How to kill all these event handlers in sj: submit?

+4
1

, , "" , , :

( ajax call fired by a sj:submit --> POST )
# in the server check if the state changed, if so returns success and the client asks to reload.

$.subscribe("change_state"){
  ...
  $('#myPanel').tabs("load", "#myTab");
  # (http GET new tab)
};

,

$.subscribe("change_state", function(event){
  if (!reloaded){
     $('#myPanel').tabs("load", "#myTab");
     reloaded = 1;
  }
)};
$.document.ready(function(){
    reloaded = null;
});

- struts, 100

0

Source: https://habr.com/ru/post/1669927/


All Articles