如何通过 API 调用删除 Bing 消歧对话框?

发布于 2024-09-01 19:08:02 字数 698 浏览 5 评论 0原文

我正在将 bing 地图集成到网页中。我正在调用 VEMap 选项的 GetDirections() 方法。当我调用 VEMap.GetDirections() 时,将 VERouteOptions.ShowDisambiguation 属性设置为 true。因此,有时我会看到以下对话框:

“选择位置”对话框 http://img249。 imageshack.us/img249/6153/bingdisambiguationdialo.png

问题是有时用户会在我的表单中输入第二组指示,并且对话框仍然存在。我已执行以下操作来纠正它:

    // In case the disambiguation dialog a.k.a "" is present from a previous direction search
    $('#myMap_veplacelistpanel').hide();

它似乎有效,但感觉像是一种次优方法。有更好的方法吗?

更新:最初我正在删除该对话框。这引起了问题,所以我现在将其隐藏,这就解决了它所产生的问题。由于我尚未接受我的自我回答,因此我正在更改问题以反映它。

I am integrating bing maps into a web page. I am calling the GetDirections() method of my VEMap option. and setting the VERouteOptions.ShowDisambiguation property to true when I call VEMap.GetDirections(). So sometimes I get the following dialog:

'Select A Location' Dialog http://img249.imageshack.us/img249/6153/bingdisambiguationdialo.png

The problem is sometimes the user will enter a second set of directions into my form, and dialog remains. I've done the following to to correct it:

    // In case the disambiguation dialog a.k.a "" is present from a previous direction search
    $('#myMap_veplacelistpanel').hide();

It seems to work, but it feels like a suboptimal approach. Is there a better way to do it?

UPDATE: Originally I was deleting the dialog. This caused problems so I just hide it now, and that solved the problems it created. Since I have not yet accepted my self answer, I am changing the question I changed the question to reflect it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱殇璃 2024-09-08 19:08:02

您可以进行以下调用来禁用对话框,而不是使用 CSS 隐藏 div:

map.ShowDisambiguationDialog(false);

那应该可以解决你的问题。

您还可以修改map.Find参数以禁用该对话框:

map.Find(what, where, type [VEFindType.Business], layer [base map], startIndex [0], numberOfResults [10], showResults[true] , createResults [true], useDefaultDisambiguation [true], setBestMapView [true], 回调)

例如:map.Find(null, searchstr, null, null, null, null, false, null, false, false, AddPin);

来源:http://msdn.microsoft.com/en-us/library/bb545005 .aspx

Rather then hiding the div with CSS, you can make the following call to disable the dialog:

map.ShowDisambiguationDialog(false);

That should solve your problem.

You can also modify the map.Find parameters to disable the dialog box:

map.Find(what, where, type [VEFindType.Business], layer [base map], startIndex [0], numberOfResults [10], showResults[true], createResults [true], useDefaultDisambiguation [true], setBestMapView [true], callback)

For example: map.Find(null, searchstr, null, null, null, null, false, null, false, false, AddPin);

Source: http://msdn.microsoft.com/en-us/library/bb545005.aspx

时光无声 2024-09-08 19:08:02

我之前的做法有问题。您需要隐藏消歧对话框,而不是删除它,否则如果您第二次输入不完整的地址,则会出现 JavaScript 错误。显然,每次输入不完整的地址时,对话框都不会重新生成,其内容只是被替换。

There is a problem with my previous approach. You need to hide the disambiguation dialog, not remove it, otherwise you get javascript errors if you enter an incomplete address a second time. Apparently the dialog is not regenerated every time an incomplete address is entered, its content is just replaces.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文