Title: messager custom buttons
Post by: sky-t on December 27, 2019, 02:42:42 AM
Hi there, i have the following 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?
Title: Re: messager custom buttons
Post by: jarry on December 29, 2019, 07:34:00 PM
Please call this code instead. 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); } } });
Title: [SOLVED] Re: messager custom buttons
Post by: sky-t on December 30, 2019, 12:33:21 AM
Hi jarry,
this works great!!!
Thank you!
|