This question is locked. New answers and comments are not allowed.
Dear Teleriks,
I have a simple menu like this :
And a jquery live function like this :
but it never handles the live function without any javascript error. But the simple click handling (commented line in above js script) works fine.
I tried more: After rendering the page, I extracted the menu rendering result and put it on the page directly like this :
although the menu not works as desired but the above script works on it in correcly!
Isn't it a bug??
It seems the related menu script(telerik.menu.min.js) do some strange works that causes this problem.
Thanks in advance
-----------------------------------------------------------------------------------
PS. EDIT :
I found the source of problem in telerik.menu.min.js file/ click function. I solved it by following corrections (It works in my case but I'm not sure if it is correct in all other cases or not )
I have a simple menu like this :
@(Html.Telerik().Menu() .Name("assResourceActions11") .Items(menu => { menu.Add() .Text("New...") .SpriteCssClasses("database_add-png") .Visible(Commons.CurrentUser.HasPermission<ResourcePermission>(ResourcePermission.Create)) .Items(menuItem => { menuItem.Add() .Text("New Resource...") .SpriteCssClasses("database_add-png") .Action("create", "Resources", new { parentId = Request["ParentId"] }); }); }) )
And a jquery live function like this :
<script type="text/javascript">
$().ready(function () {
//$('#assResourceActions11 a').click(function () { alert(22); });
$('#assResourceActions11 a').live('click', function () { alert(1); });
});
</script>
but it never handles the live function without any javascript error. But the simple click handling (commented line in above js script) works fine.
I tried more: After rendering the page, I extracted the menu rendering result and put it on the page directly like this :
<ul class="t-widget t-reset t-header t-menu" id="assResourceActions11"> <li class="t-item t-state-default" style=""><span class="t-link"><span class="t-sprite database_add-png"> </span>عامل جدید<span class="t-icon t-arrow-down"></span></span><div class="t-animation-container" style="width: 138px; height: 22px; display: none;"> <ul class="t-group" style="display: block; width: 136px; margin-top: -22px;"> <li class="t-item t-state-default"><a class="t-link" href="/safat/Resources/Resources/create"> <span class="t-sprite database_add-png"></span>عامل ساده جدید...</a></li></ul> </div> </li> </ul>
although the menu not works as desired but the above script works on it in correcly!
Isn't it a bug??
It seems the related menu script(telerik.menu.min.js) do some strange works that causes this problem.
Thanks in advance
-----------------------------------------------------------------------------------
PS. EDIT :
I found the source of problem in telerik.menu.min.js file/ click function. I solved it by following corrections (It works in my case but I'm not sure if it is correct in all other cases or not )
click: function (e, element) { //e.stopPropagation(); by moravej var $li = $(element); if ($li.hasClass('t-state-disabled')) { e.stopPropagation(); //by moravej e.preventDefault(); return; } if ($t.trigger(this.element, 'select', { item: $li[0] })) { e.stopPropagation(); //by moravej e.preventDefault(); return; } if (!$li.parent().hasClass('t-menu') || !this.openOnClick) { return; } e.stopPropagation(); //by moravej e.preventDefault(); this.clicked = true; this.triggerEvent('open', $li); this.open($li); },