EasyUI Dialog Buttons bind click event

1. The jsp page defines dialog and Buttons;
<div id="win" style="padding: 5px" modal=true draggable=false class="easyui-dialog" closed=true
     data-options="
			buttons:[{
				text:'save',
			},{
				text:'close',
			}]">

2. js file method;

//buttons text value!

$.extend($.fn.dialog.methods, {
        bindButtonEvents: function (jq, param) {
            return jq.each(function () {
                var dialog = $(this);
                dialog.parent().on('click', '.dialog-button a', function (e) {
                    var text = $(this).linkbutton('options').text;
                    var method = param[text];
                    if (method) { method(); }
                });
            });
        }
    });
//dialog button method
    $('#win').dialog('bindButtonEvents', {
        save: function () {
            console.log('hellolllllll')
        },
        close: function () {
            console.log('close..............')

        }
    });

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326791311&siteId=291194637