如何从页面中删除 YUI 图表
我需要在页面中创建和删除 YUI 图表。要删除,我正在执行 $('.chart').remove()
来删除包含的 DIV。但是,这会在此脚本中引发空引用异常:
try {
document.getElementById("yuiswf1").SetReturnValue(__flash__toXML(YAHOO.widget.SWF.eventHandler("yuiswf1",
({category:"info",message:"resize (width: 0, height: 0)",type:"log"})
)) ); }
catch (e) {
document.getElementById("yuiswf1").SetReturnValue("<exception>" + e + "</exception>");
}
我假设 YUI 为某些事件处理程序附加了此代码,该事件处理程序由于 DIV 已被删除而失败。
如何删除 YUI 图表而不导致此异常?
I need to create and remove YUI charts from a page. To remove, I am doing $('.chart').remove()
to get rid of the containing DIV. However, this raises a null reference exception in this script:
try {
document.getElementById("yuiswf1").SetReturnValue(__flash__toXML(YAHOO.widget.SWF.eventHandler("yuiswf1",
({category:"info",message:"resize (width: 0, height: 0)",type:"log"})
)) ); }
catch (e) {
document.getElementById("yuiswf1").SetReturnValue("<exception>" + e + "</exception>");
}
I assume YUI attaches this code for some event handler which is failing since the DIV has been removed.
How can I remove a YUI chart without causing this exception?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在删除其父 div 之前,尝试在图表对象上调用 destroy 方法。
mychart.destroy(); (假设您的图表变量是 mychart)
如果您仍然遇到问题,您可以尝试在 yui 库的论坛上发帖。
http://yuilibrary.com/forum/
特里普
Try calling the destroy method on your chart object before removing its parent div.
mychart.destroy(); (assuming your variable for the chart is mychart)
If you still have issues, you can try posting back on yui library's forum.
http://yuilibrary.com/forum/
Tripp