Your code looks fine. $(this).dialog('close') should work, as can be seen in
these demos:

http://jqueryui.com/demos/dialog/modal-message.html

http://jqueryui.com/demos/dialog/modal-confirmation.html

http://jqueryui.com/demos/dialog/modal-form.html

- Richard

On Mon, May 18, 2009 at 6:03 AM, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to