SharePoint debug : launchPoint given is already associated with a callout
来源:互联网 发布:e25数据 编辑:程序博客网 时间:2024/05/17 22:41
今天在写SharePoint 2013 callout的时候,发现浏览器报了一个错误:calloutManager: launchPoint given is already associated with a callout
代码很简单:
var calloutElement = document.getElementById(divId); var calloutOptions = new CalloutOptions(); calloutOptions.ID = 'calloutid'; calloutOptions.launchPoint = calloutElement; calloutOptions.beakOrientation = 'leftRight'; calloutOptions.content = 'This is Callout Description'; calloutOptions.title = 'This is Callout Title'; CalloutManager.createNew(calloutOptions);
错误信息很明显,应该是我重复向一个div绑定callout引起的,最简单的解决办法是try catch捕获这个异常:
try{ CalloutManager.createNew(calloutOptions);}catch(e){}
然后我查看了一下CalloutManager的代码,发现可以使用这个方法判断一个div是否已经绑定了一个callout:
var callout = CalloutManager.getFromLaunchPointIfExists(launchPoint);方法getFromLaunchPointIfExists的参数launchPoint就是div对象,如果返回值callout不为空,就说明这个div已经绑定了callout了。
除此之外,CalloutManager其实已经提供了一个方法处理重复绑定的问题,这个方法是createNewIfNecessary,这个方法会首先使用getFromLaunchPointIfExists方法判断div上是否已经绑定了callout,如果已经绑定,就不会再次绑定了,所以正确的代码是使用createNewIfNecessary而不是createNew:
var calloutElement = document.getElementById(divId); var calloutOptions = new CalloutOptions(); calloutOptions.ID = 'Calloutid'; calloutOptions.launchPoint = calloutElement; calloutOptions.beakOrientation = 'leftRight'; calloutOptions.content = 'This is Callout Description'; calloutOptions.title = 'This is Callout Title'; CalloutManager.createNewIfNecessary(calloutOptions);
这样就不会出现异常信息了。
0 0
- SharePoint debug : launchPoint given is already associated with a callout
- Graphic is already associated with another layer
- [Debug - SharePoint] Sys.InvalidOperationException: Object xxx already exists and is not a namespace
- 解决a different object with the same identifier value was already associated with the session错误
- 解决a different object with the same identifier value was already associated with the session错误
- a different object with the same identifier value was already associated with the session的解决办法
- 解决a different object with the same identifier value was already associated with the session错误
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- 解决a different object with the same identifier value was already associated with the session错误
- a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- 再次碰到:a different object with the same identifier value was already associated with the session
- a different object with the same identifier value was already associated with the session
- 解决a different object with the same identifier value was already associated with the session错误
- 解决a different object with the same identifier value was already associated with the session错误
- HibernateSystemException: a different object with the same identifier value was already associated with the session.
- a different object with the same identifier value was already associated with the session
- Transact-SQL编程
- 学习笔记:使用echarts画图表
- PHP打印JSON数据谷歌浏览器打印JSON数据
- Android访问网络,使用HttpURLConnection还是HttpClient?
- C#中的out和ref
- SharePoint debug : launchPoint given is already associated with a callout
- CSDN湖大高校俱乐部活动的吐槽
- front-end development 总结
- 社交柔道术 - 《影响力》读书笔记(一)
- 关于session的实现:cookie与url重写
- sbt/sbt assembly 编译spark源码出错问题解决方法
- hdoj problem 1233 还是畅通工程(并查集+动态规划)
- 顺序栈的验证实验
- opencv中文网