EasyUI Forum
May 16, 2024, 03:53:36 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: messager custom buttons  (Read 3364 times)
sky-t
Full Member
***
Posts: 145


View Profile
« on: December 27, 2019, 02:42:42 AM »

Hi there,

i have the following code:

Code:
        var dlg = $.messager.prompt({
            iconCls: 'icon-contacts',
            title: ' testtitle',
            msg: 'testmessage',
            shadow: false,
            buttons:[{
                value: true,
                plain: true,
                iconCls: 'icon-save',
                text: 'save',
                width: 150,
            },{
                plain: true,
                iconCls: 'icon-cancel',
                text: 'cancel',
                width: 100,
                value: false
            }],
            fn: function(r){
                if (r) {
                    alert(r);
                }
            }
        });

When clicking the buttons there is no function - why?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: December 29, 2019, 07:34:00 PM »

Please call this code instead.
Code:
var dlg = $.messager.prompt({
    iconCls: 'icon-contacts',
    title: ' testtitle',
    msg: 'testmessage',
    shadow: false,
    buttons:[{
        plain: true,
        iconCls: 'icon-save',
        text: 'save',
        width: 150,
        onClick: function(){
        var opts = dlg.dialog('options');
        var value = dlg.find('.messager-input').val();
        dlg.dialog('close');
        opts.fn(value);
        }
    },{
        plain: true,
        iconCls: 'icon-cancel',
        text: 'cancel',
        width: 100,
        onClick: function(){
        var opts = dlg.dialog('options');
        dlg.dialog('close');
        opts.fn();
        }
    }],
    fn: function(r){
        if (r) {
            alert(r);
        }
    }
});
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #2 on: December 30, 2019, 12:33:21 AM »

Hi jarry,


this works great!!!


Thank you!
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!