This topic contains 2 replies, has 2 voices, and was last updated by Todor 5 years, 8 months ago.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
jQuery UI Widgets › Forums › Navigation › Menu, Context Menu › jqxMenu loses itemClicked event
This topic contains 2 replies, has 2 voices, and was last updated by Todor 5 years, 8 months ago.
I’m testing the jqxMenu within a grid. The same grid is used/initialized on two pages and thus, the same menu is reused.
Menu is pretty standard with three options and itemclick event.
$("#Menu").on('itemclick',
function (event)
{
alert('clicked menu')
var args = event.args;
var rowindex = $("#myGrid").jqxGrid('getselectedrowindex');
var command = $.trim($(args).text());
if (command == "Edit")
{
doEdit();
}
else if (command == "Delete")
{
doDelete()
}
.......
The events get fired properly when the item is clicked. However, if I load another page with the same (reused grid and menu) the menu displays correctly but the itemclick event is no longer triggered.
I though it might be a double binding of the event so I added $(“#Menu”).unbind(); before adding the itemclick event. No luck.
Interestingly, if I add my own event handler as below, the events always get fired – e.g.
$("#Menu ul li").on('click',
function (event)
{
alert('clicked menu')
//var args = event.args;
//var command = $.trim($(args).text());
var command = $.trim(event.currentTarget.textContent)
var rowindex = $("#myGrid").jqxGrid('getselectedrowindex');
if (command == "Edit")
{
doEdit();
}
else if (command == "Delete")
{
doDelete();
}
.......
So, my question is, why are my custom on.click events working every time through but not the itemclick event. Is there some other way to clear/reinit?
Thanks!
Hello – any ideas on this issue?
Hello robf,
Please share a whole jsfiddle/codepen example demonstrating the reported issue, so that we may determine what causes it.
Best Regards,
Todor
jQWidgets Team
https://www.jqwidgets.com
You must be logged in to reply to this topic.