Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Adding elements to HTML head in report item presentation
Adding elements to HTML head in report item presentation [message #829489] Mon, 26 March 2012 11:07 Go to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
Looking at IReportItemPresentation and ReportItemPresentationBase, it doesn't seem possible to emit something in the head of HTML report when the item is present. Is this correct?

From quick googling it seems that <style> tags in body work on all major browsers, still making things valid, if possible, seems better Smile
Re: Adding elements to HTML head in report item presentation [message #829655 is a reply to message #829489] Mon, 26 March 2012 15:51 Go to previous messageGo to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
Actually, this turned out to be a problem Sad

When I just add <style> tag, it's missing in Firefox completely; when I try to add it to head using Javascript, BIRT seems to try to escape it somewhere and mess things up. From MyItemPresentation.onRowSets I return a string which ends like this:
$j('<style type="text/css"> ... lots of css rules ... </style>').appendTo('head');
</script>
<input type="text" class="param" name="DTParam" id="DateTimePickerItem_2"/>
<script>$j('#DateTimePickerItem_2').datetimepicker({dateFormat: 'yy-mm-dd', timeFormat: 'hh:mm:ss.l', showSecond: true, autoSize: true})
</script>

and still have the same in HTMLPageLM.layout(), according to debugger. But when I view source of the resulting report in FireFox, I see the same except for the closing style tag: there is <\/style> there instead.

1. Any reason you know of for this to happen?
2. Can I see the precise source of the page emitted by BIRT, so I can check if it's Firefox's fault?
Re: Adding elements to HTML head in report item presentation [message #830049 is a reply to message #829655] Tue, 27 March 2012 05:35 Go to previous messageGo to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
Duh. That's correct behavior: http://www.herongyang.com/JavaScript/Browser-Escape-Script-Tag-in-String-Literal.html Still need to figure out why the styles don't get applied...

And finally, it turns out that fitting several CSS rules on one line using ";" doesn't work, " " is needed instead.

[Updated on: Tue, 27 March 2012 06:05]

Report message to a moderator

Re: Adding elements to HTML head in report item presentation [message #830762 is a reply to message #830049] Wed, 28 March 2012 03:03 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Do the styles get applied if you use /preview (Preview in HTML) instead
of the WebViewer?

Jason

On 3/27/2012 1:35 AM, Alexey Romanov wrote:
> Duh. That's correct behavior:
> http://www.herongyang.com/JavaScript/Browser-Escape-Script-Tag-in-String-Literal.html
> Still need to figure out why the styles don't get applied...
Re: Adding elements to HTML head in report item presentation [message #830795 is a reply to message #830762] Wed, 28 March 2012 04:06 Go to previous message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
As I've said, the problem was that I was constructing the style tag incorrectly Smile
Previous Topic:Performance is better with firefox
Next Topic:Scripted Data Source and custom ODA data source: advantages and disadvantages
Goto Forum:
  


Current Time: Sun Dec 21 03:22:17 GMT 2014

Powered by FUDForum. Page generated in 0.16665 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software