Yes, it seems to fail because of the "data" variable. Like you, I have writed the function who display the dialog and if I test it with 'Hello world' as "data" the close button works fine but with the $get(...) result as data the close button do nothing.
How can I test the $get(..) result to discover the problem ? Thanks On May 19, 5:24 am, thaianhduc <[email protected]> wrote: > I have tried to make a test as your script. However, there is no > problem with it. > > what i have done is: > a function like this: > function test_from_g(data) { > $("<div class=\"dialogcontainer\"></div>").append > (data).dialog({ > modal: true, > width: 300, > height: 400, > bgiframe: true, > buttons: { > '<fmt:message key="label.Terminate" />': function() { > $(this).dialog("close"); > }, > '<fmt:message key="label.Modify" />': function() { > window.location = window.location; > }, > '<fmt:message key="label.Print" />': function() { > $.wait('<fmt:message key="label.Printing" />'); > } > }, > title: 'Done' > }); > } > > and a button in html to call it: > <button id="test" onclick="test_from_g('<p>Testing from google</p>'); > return false;">Test from google</button> > > And it works! Therefore, please check your data variable appended to > the div. There might be something you can look at. Another way is > setting the debug inside the handler for close and see what it > actually does. > > Whenever something go wrong with JS i usually use firebug and it > helps. Please try. > > On May 18, 5:03 pm, GervaisB <[email protected]> wrote: > > > Nobody can, help me ? > > What are you doing for closing a dialog from a button in itself ? > > > On May 15, 12:41 pm, GervaisB <[email protected]> wrote: > > > > Hi, > > > > Well, I have used "this" because the jquery api has an example who us > > > "this" (http://docs.jquery.com/UI/API/1.7/Dialog#option-buttons). But > > > with a var moh refer to the ccontent or "this", the result is the > > > same : the dialog never close... > > > > On May 15, 4:20 am, thaianhduc <[email protected]> wrote: > > > > > Wow, "this" inside the function prefer to the button itself not the > > > > div dialog. > > > > A proposed solution: > > > > > function(data) { > > > > var _dlg = $("<div class=\"dialogcontainer\"></div>").append(data); > > > > _dlg.dialog({ > > > > modal: true, > > > > width: width, > > > > height: height, > > > > bgiframe: true, > > > > buttons : { > > > > '<fmt:message key="label.Terminate" />' > > > > : function(){ > > > > > $(_dlg).dialog("close"); > > > > }, > > > > '<fmt:message key="label.Modify" />' : > > > > function(){ > > > > > window.location=window.location; > > > > }, > > > > '<fmt:message key="label.Print" />' : > > > > function(){ > > > > $.wait('<fmt:message > > > > key="label.Printing" />'); > > > > } > > > > }, > > > > title: 'Done' > > > > }); > > > > > Hope it help. > > > > > On May 14, 4:22 am, GervaisB <[email protected]> wrote: > > > > > > Hi everybody, > > > > > > I have a dialog who is built like this : > > > > > --- 8< > > > > > ----------------------------------------------------------------------------------------------------- > > > > > var width = 500; > > > > > var height = 500; > > > > > if (navigator.appName.indexOf("Microsoft")!=-1) { > > > > > width = document.body.offsetWidth*0.6; > > > > > height = document.body.offsetHeight*0.75;} else { > > > > > > width = window.innerWidth*0.6; > > > > > height = window.innerHeight*0.75; > > > > > > } > > > > > > $.get('<cor:url value="/frames/studentfolder/resume.html?folder=$ > > > > > {folder}" />', > > > > > function(data) { > > > > > $("<div > > > > > class=\"dialogcontainer\"></div>").append(data).dialog({ > > > > > modal: true, > > > > > width: width, > > > > > height: height, > > > > > bgiframe: true, > > > > > buttons : { > > > > > '<fmt:message key="label.Terminate" > > > > > />' : function(){ > > > > > $(this).dialog("close"); > > > > > }, > > > > > '<fmt:message key="label.Modify" />' > > > > > : function(){ > > > > > > > > > > window.location=window.location; > > > > > }, > > > > > '<fmt:message key="label.Print" />' : > > > > > function(){ > > > > > $.wait('<fmt:message > > > > > key="label.Printing" />'); > > > > > } > > > > > }, > > > > > title: 'Done' > > > > > });}); > > > > > > --- 8< > > > > > ----------------------------------------------------------------------------------------------------- > > > > > > With the first button "<fmt:message key="label.Terminate" />" I want > > > > > to close the dialog but the line "$(this).dialog('close');" doesn't > > > > > seems to work. > > > > > I am under Firefox with Firebug and no errors occur.. > > > > > > How can I close a dialog from itself ? > > > > > > Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
