简体   繁体   中英

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). 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.

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 . 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.

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? 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). And dev tools shows basically the same thing between chrome and IE. Whenever my web service goes back up ill WinMerge them and look for any peculiarities/differences between them. 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):

看起来在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.

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. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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