This question is locked. New answers and comments are not allowed.
Hello,
Here's my scenario: I have several nested dialogs (contained in Telerik MVC Windows) that are loaded as partial views. There is a dialog-specific object that encapsulates the functionality of each of these dialogs and contains a handler for the each dialog's menu. I'd like to bind the onSelect handler of each dialog's menu to a method in the javascript dialog object. From the script that is emitted when the menu loads, I see a call like this "jQuery('#createOrEdit_menu').tMenu({ onSelect: createOrEditMenuSelect });". I've tried this code in the handler that initializes the dialog, but I'm not having any luck.
I built a simple test project that has a menu declared in a partial view like this:
And then in the AJAX handler that loads the partial view:
And the sampler handler, declare in the calling view:
Problem is, createOrEditMenuSelect in not called, rather the "grokMe" function that is contained in the partial view is called. So, my question is...can I change the onSelect handler of the menu after it has been created?
Thanks for taking a look...
Sean
Here's my scenario: I have several nested dialogs (contained in Telerik MVC Windows) that are loaded as partial views. There is a dialog-specific object that encapsulates the functionality of each of these dialogs and contains a handler for the each dialog's menu. I'd like to bind the onSelect handler of each dialog's menu to a method in the javascript dialog object. From the script that is emitted when the menu loads, I see a call like this "jQuery('#createOrEdit_menu').tMenu({ onSelect: createOrEditMenuSelect });". I've tried this code in the handler that initializes the dialog, but I'm not having any luck.
I built a simple test project that has a menu declared in a partial view like this:
Html.Telerik().Menu().Name("createOrEdit_menu") .ClientEvents(events => events.OnSelect("grokMe")) .Items(menu =><snip>And then in the AJAX handler that loads the partial view:
success: function (r) { var dlg = $("#new_dlg").data('tWindow'); dlg.center(); dlg.title("New"); dlg.open(); dlg.content(r); jQuery('#createOrEdit_menu').tMenu({ onSelect: createOrEditMenuSelect });}And the sampler handler, declare in the calling view:
function createOrEditMenuSelect(e) { var item = $(e.item); if (item.text() === "Cancel") { $("#new_dlg").data("tWindow").close(); }}Thanks for taking a look...
Sean