Hello
I want to cancel or avoid the url navigation on WebExplorerBar item. I’m attaching the sample, I’m not sure whether exist a way to make my issue. I don't want that WebExplorerBar item opens the url in another page, but I need its url target.
Is there any way to do this? Please, help me!. Some suggestion?
Thanks.
Geovanny Domínguez
Does anyone here help me? Please!
Regards.
Hi Geovanny,
Thank you for report.WebExplorerBar does not have an option to cancel navigation.
An application may get around by processing and canceling original "click" browser event.
The ClientEvents.ItemClick can not be used for that purpose, because it is raised not on "click" event, but on "mouseup". Since browser raises "click" after "mouseup", application may process ItemClick which provides reference to item and set the "cancel-click" flag, which will allow the click-handler to cancel event and prevent default navigation to A.href.
Below is example for you:
function WebExplorerBar1_Initialize(sender){ $addHandler(sender.get_element(), 'click', function(e) { // cancel navigation by A.href if (sender._cancelClick) $util.cancelEvent(e) });}function WebExplorerBar1_ItemClick(sender, eventArgs){ // reset cancel-navigation flag delete sender._cancelClick; // condition to cancel navigation by A.href if (!eventArgs.getExplorerBarItem().hasChildren()) { // set cancel-navigation flag sender._cancelClick = true; UrlSelected(eventArgs); } else {return;}}
<ig:WebExplorerBar ...> <ClientEvents ItemClick="WebExplorerBar1_ItemClick" Initialize="WebExplorerBar1_Initialize" ItemSelecting="WebExplorerBar1_ItemSelecting" /> ...</ig:WebExplorerBar>