event handler when function called and pass parameters
I have the following code in js file:
var NM= {
showPopupCommand: function(obj) {
var commandType = $(obj).attr('data-command-type');
var contextType = $(obj).attr('data-context-type');
var title = $(obj).attr('data-title');
var popup = $('#commandPopup').data("kendoWindow").refresh(
{
url: "/Context/GetView",
data:
{ contextType: contextType, commandType: commandType }
}
)
.title(title);
popup.bind("refresh", function () {
popup.center();
popup.open();
});
}
}
In the function is exist the data object. I need to pass additional data
to this object:
data:
{ contextType: contextType, commandType: commandType, otherObject }
I can't pass additional data to showPopupCommand because the button
generated automatically and additional data have to add dynamically. The
button looks like:
<button class='link' data-... onClick='showPopupClick(this)'/>
This is what I want:
1. When showPopupCommand is called then generate event.
2. I write handler for the event
3. In the handler I create additional data object and pass to
showPopupCommand
I'm very new in Javascript. Can you help me write the code?
No comments:
Post a Comment