java - Close wicket modal window by pressing a button -


i want close modal window pressing button residing on modal window page. not working. modal window page contains video player.

my code is:

public class playvideowindow extends webpage {     public playvideowindow(final page modalwindowpage, final modalwindow window, final string itemid) {         final string xmlfilepath = ((webapplication) getapplication()).getservletcontext().getrealpath("/resources/video/xml/video.xml");         string filename = null;           try {             filename = webvideo.getvideo(itemid, xmlfilepath);         } catch (saxexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }                  webmarkupcontainer videocontainer = new webmarkupcontainer("videodiv");         add(videocontainer);          add(headercontributor.forjavascript("resources/video/js/swfobject.js"));          final string script = "var swfversionstr = '10.0.0';"             + "var xiswfurlstr = 'playerproductinstall.swf';"             + "var flashvars = {};"             + "flashvars.filename = '"+ filename +"'" +";"             + "var params = {};"             + "params.wmode = 'transparent';"             + "params.quality = 'high';"             + "params.allowscriptaccess = 'always';"             + "params.allowfullscreen = 'true';"             + "params.allownetworking = 'all';"             + "var attributes = {};"             + "attributes.id = 'player';"             + "attributes.name = 'player';"             + "attributes.align = 'left';"             + "swfobject.embedswf('/jtrac/resources/video/swf/player.swf', 'moviediv', '320', '320', swfversionstr, xiswfurlstr, flashvars, params, attributes);"             + "swfobject.createcss('#flashcontent', 'display:block;text-align:left;');";      add(new abstractbehavior() {         public void renderhead(iheaderresponse response) {             super.renderhead(response);             response.renderonloadjavascript(script);         }     });      //videocontainer.add(new ajaxbutton("close") {       //  protected void onsubmit(final ajaxrequesttarget target, final form form) {         //    playvideowindow.this.close(target);         //}     //});      //button closebutton;     //videocontainer.add(closebutton = new button("close"));     //closebutton.add(new attributeappender("onclick", new model("window.close();"), ";"));     } } 

and here's html:

<div wicket:id="videodiv"> <div id="moviediv"></div> <input type="button" wicket:id="close" /> </div> 

the commented-out lines of code tests. information helpful me. thank you.

edit:
solved problem code:

add(new ajaxlink("close") {         public void onclick(ajaxrequesttarget target) {             window.close(target);         }     }); 

all need insert call close method in button's code.

to close window there multiple options. static method close(ajaxrequesttarget) can used close window handler of ajax link inside window.

source: documentation of modalwindow in 1.4.7 release.

i see solved problem link, post mentioned button, don't know if link solution workaround until got better. also, since close static method, should call class, not instance.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -