如何从页面中删除 YUI 图表

发布于 2024-08-19 20:45:52 字数 519 浏览 4 评论 0原文

我需要在页面中创建和删除 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 技术交流群。

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

发布评论

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

评论(1

被你宠の有点坏 2024-08-26 20:45:52

在删除其父 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

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