Salesforce.com Visualforce Google 地图
我需要一些帮助,我认为这篇文章会对我有所帮助,但我对 Google 地图和 Visualforce 非常陌生。 eyescream 回答,请参阅帖子 如何将 Salesforce 与 Google 地图集成?。
我的问题非常相似,但我不需要搜索记录来绘制它们可作为相关列表使用。
我有两个名为 Wildlife__c
和 Sighting__c
的自定义对象。
目击功能可以查找野生动物,因此您可以记录特定动物的目击事件。目击对象有两个自定义字段 long__c
和 lat__c
。
我想要野生动物页面上的地图,可以浏览所有不同的目击事件并在地图上标记。该地图将简单地添加为“野生动物”页面的一个组件。
我可以在目击对象上通过一次目击生成一张地图,但我可以在野生动物对象上复制这一点。我想我需要创建一个数组,但不知道如何创建。
非常感谢
罗斯
I need some help and I think this post would help me but I am very new to Google maps and Visualforce. answered by eyescream see post How do I integrate Salesforce with Google Maps?.
My problem is very similar but I don't need to search for the records to plot they are available as a related list.
I have two custom objects called Wildlife__c
and Sighting__c
.
Sightings has a lookup to Wildlife so you can record a sighting of a particular animal. The sightings object has two custom fields long__c
and lat__c
.
I would like a map on the Wildlife page that looks through and puts markers on a map for all the different sightings. The map will simply be added as a component of the Wildlife page.
I can on the sightings object generate a map with one sighting, but I can replicated this on the wildlife object. I think I need to create an array but not sure how.
Many thanks
Ross
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要找出包含相关列表的 html 表的 ID。您可以使用 Firefox 插件(我更喜欢 Firebug,但是< href="https://addons.mozilla.org/pl/firefox/addon/60/" rel="nofollow noreferrer">Web 开发人员工具栏也很酷)。对于 Internet Explorer...我猜是“调试器”;如果您安装了 Visual Studio 或某些 IE 插件,则将语句放在 JavaScript 中的某处即可工作。
无论采用何种方式,您应该能够精确定位与此类似的 HTML:
现在看看我的答案中的 JavaScript,尤其是这部分:
将您找到的 ID 插入第一行。找出哪个单元格包含您的纬度和经度信息。您可以再次使用调试器找到它,或者通过将alert()框放入循环内进行实验。
最后一部分是您不需要对地址进行地理编码,您已经有了 LAT 和 LONG。因此,直接跳到函数 FinalizeDrawingMap() 并重用它的内容。您可以跳过尝试猜测最佳缩放的部分(甚至更好 - 检查 Google Maps API 是否有更好的技巧;这是快速且丑陋的黑客攻击)。你所需要的核心在于
“好运”和“好运”。欢迎来到 StackOverflow :)
You need to figure out the ID of html table which contains your related list. You could use a Firefox plugin for that (I prefer Firebug, but Web Developer Toolbar is also cool). For Internet Explorer... I guess the "debugger;" statement put somewhere in JavaScript would work if you have Visual Studio or some IE plugin installed.
Whatever the means, you should be able to pinpoint to HTML similar to this:
Now have a look at JavaScript in my answer, especially this part:
Insert the ID you have found into first line. Figure out which <td> cell contains your latitude and longitude information. You can again find it out with your debugger or experiment by putting alert() box inside the loop.
Last part is that you don't need to geocode your addresses, you already have LAT and LONG. So skip directly to function finalizeDrawingMap() and reuse it's content. You can skip the part that tries to guess best zoom (or even better - check Google Maps API if there's better trick for it; that was quick and ugly hack). The core of what you need lies in
Good luck & welcome to StackOverflow :)