EasyUI Forum
October 16, 2025, 08:23:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: create dialog from script  (Read 17302 times)
alex.capurro
Newbie
*
Posts: 25


View Profile Email
« on: February 08, 2012, 05:24:40 AM »

Hi,

im trying to create a dialog with two buttons (yes, no) from script. The examples on the site already have a the pop visible with divs. Basically when a user clicks on a link on my site i want the dialog to appear.

So far I can do that by using this:

Quote
$.messager.confirm('Unsaved Changes', 'Save before proceeding?', function(r){
            if (r){
               //user said yes
               alert('confirmed:'+r);
            } else {   
               //user said no, so do not save and redirect
               parent.location.href = requestedLink;
            }

However what I would like to know is how do i tell it to show a 'yes' button and a 'no' button? Obviously the dialog should only be shown when the user clicks on a link on my site.. The documentation does not seem to show this, neither does the demo.

Thanks
Logged
alex.capurro
Newbie
*
Posts: 25


View Profile Email
« Reply #1 on: February 08, 2012, 06:56:06 AM »

ok problem solved. This is what i ended up doing:

Quote
$(function(){
      $('#dd').dialog({
         closed:true,
         title:'Unsaved Changes',
         buttons:[{
            text:'Yes',
            iconCls:'icon-ok',
            handler:function(){
               //do something
            }
         },{
            text:'No',
            handler:function(){
               //do not save but go to link requested
               $('#dd').dialog('close');
            }
         },{
            text:'Cancel',
            handler:function(){
               //do nothing
               $('#dd').dialog('close');
            }
         }]
      });
   });

I still needed to have a predefined div, but i just set it to closed in the code above.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!