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>
Hi Viktor,
Thank you very much for answering. It's just what I need. See you next time!
For now it is not available yet. It will be available in coming service releases for 2012.1-2013.1, but not 2011.1. So, you may use work around.
I'm using NetAdvantage 2011.1, Version=11.1.20111.1006. from What version of NetAdvantage is available this improvement?
Thanks
Geovanny Domínguez.
The WebExplorerBar.ClientEvents.ItemClick was improved and second param eventArgs will extend CancelEventArgs with get/set_cancel member methods. If application will call eventArgs.set_cancel(true), then that will disable navigation to NavigateUrl.
That improvement will be also available for NodeClick of WebDataTree, because WebDataTree is used as internal "engine" of WebExplorerBar.