简体   繁体   English

Telerik图表无法正确加载(ajax /脚本问题?)

[英]Telerik chart not loading correctly (ajax/script issue?)

I have a page which contains user controls with Telerik Charts (grids also, but they work fine). 我有一个页面,其中包含带有Telerik图表的用户控件(也有网格,但它们工作正常)。 From this page, the user can click on a button to be redirected to a "Printer-Friendly Version" type page, which opens a new window via javascript and goes through a slightly different view (for formatting and stuff), but the telerik code is all the same. 在此页面上,用户可以单击一个按钮以重定向到“打印机友好版本”类型的页面,该页面通过javascript打开一个新窗口 ,并通过略有不同的视图(用于格式和内容),但是telerik代码都是一样的。

The problem is , my Chart displays just fine in the original window, but the new window displays basically an empty chart with no data . 问题是 ,我的图表在原始窗口中显示得很好,但是新窗口基本上显示了一个没有数据的空图表 This bug is only present in IE, and only applies to Charts . 此错误仅在IE中存在,并且仅适用于Charts Grids work fine, for whatever reason. 无论出于何种原因,网格都能正常工作。 I'm thinking this is due to differences in script caching between browsers -- correct me if I'm wrong, I'm semi-new to client-directed web development. 我认为这是由于浏览器之间脚本缓存的差异所致-如果我错了,请纠正我,我对客户导向的Web开发是半新的。

Anyway I read somewhere that Telerik has issues with loading data and/or js files when loaded via ajax, so maybe that's the problem? 无论如何,我在某个地方读到Telerik在通过Ajax加载时加载数据和/或js文件时遇到问题,所以也许是问题所在吗? If so, how could I get around this? 如果是这样,我该如何解决? And if not, any ideas on what could be causing this issue? 如果没有,关于什么可能导致此问题的任何想法? It's causing me a great deal of frustration, since a print preview page seems like it should be the easiest of jobs. 这让我非常沮丧,因为打印预览页似乎应该是最简单的工作。

Edit: 编辑:

The charts are being rendered as html (if somebody can explain how to render them as images, that would be awesome). 图表以html形式呈现(如果有人可以解释如何将它们呈现为图像,那真是太棒了)。 And dev tools shows basically the same thing between chrome and IE. 开发工具显示了chrome和IE之间的基本相同之处。 Whenever my web service goes back up ill WinMerge them and look for any peculiarities/differences between them. 每当我的Web服务因WinMerge不适而备份时,寻找它们之间的任何特性/差异。 In the mean time, though, the "render as an image" concept sounds promising. 但是,与此同时,“渲染为图像”的概念听起来很有希望。 That way I could just save the image from the first page, and insert it right into the print preview page, right?. 这样,我可以只保存第一页中的图像,然后将其插入到打印预览页中,对吗? And since it's a print-preview page, it's not going to need to be interactive or anything, so that'd work out nicely. 而且由于它是打印预览页面,因此不需要是交互式的或任何其他内容,因此效果很好。

Another (important) Edit: 另一个(重要的)编辑:

These are probably the culprit... 这些可能是罪魁祸首...

这是一些jQuery错误..但是为什么呢?

And here is a little more detail on that: 这里有一些细节:

不确定<code> b </ code>指的是什么,但这似乎是问题所在

And here is a side-by-side of it working(in chrome) and not working (in IE): 这是它的并排工作(在chrome中)和不工作(在IE中):

看起来在IE中只是没有提取任何数据

Have you considered using a print-specific stylesheet instead, eg 您是否考虑过使用特定于打印的样式表,例如

<link rel="stylesheet" type="text/css" media="print" href="print.css" />

In which you specify the styling to apply when printing. 在其中指定要在打印时应用的样式。

That way, you avoid reloading the page (duplicate database hits, etc.) and don't need to delve into the AJAX of Telerik's controls. 这样,您可以避免重新加载页面(重复的数据库命中等),而无需深入研究Telerik控件的AJAX。

EDIT: 编辑:

Regarding using an image rather than HTML, first make sure you won't lose any features/detail, then check out the .Save() method of the RadChart control. 关于使用图像而不是HTML,首先请确保您不会丢失任何功能/细节,然后检查RadChart控件的.Save()方法。 You could either save it to a memory stream, or if you want to re-use the image save it to a directory on the webserver and clean it up periodically. 您既可以将其保存到内存流中,也可以重新使用映像,然后将其保存到Web服务器上的目录中并定期清理。 That way, you can just point your print version to the image and not re-generate it. 这样,您就可以将打印版本指向该图像,而无需重新生成它。

This Telerik forum post may be of use. 这个Telerik论坛帖子可能有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM