screen.width function doesn't work in Birt [message #652578] |
Fri, 04 February 2011 15:34 |
alptugay Messages: 1 Registered: February 2011 |
Junior Member |
|
|
Hello all,
My problem is that I have a table with very long strings. These long strings doesn't fit the screen size, exceeds the screen size and therefore a horizontal scroll bar appears in the browser. I don't want to define a static length for the table, grid etc. Because it will differ from monitor to monitor. And %100 is not working as I want. So what I wrote a script in the report's beforafactory, afterfactory, beforerender, afterrender, onpagestart events. Because I don't know exactly in which event I shoul write it. Whatever the script is this:
reportContext.getReportRunnable().designHandle.getDesignHandle().findMasterPage("SimpleMasterPage").setProperty("width",screen.width+"px")
This script doesn't work. Whereas when I write it like the one below it works.
reportContext.getReportRunnable().designHandle.getDesignHandle().findMasterPage("SimpleMasterPage").setProperty("width",1440+"px")
Some friends may say that masterpage doesn't accept "px" and that It only accepts metric units. Actually it works, because the second script is functionin normally. But Fyi I have also tried writing "mm" instead of "px" still the same. The first one works the second one doesn't.
I am using designer 2.5.2 and reportviewer 2.6.1
Any ideas why screen.width doesnt work?
|
|
|
Re: screen.width function doesn't work in Birt [message #652642 is a reply to message #652578] |
Fri, 04 February 2011 19:45 |
|
Those event handlers work on the server and do not have visibility into
what the client browser settings are set to. One option may be to put a
bookmark property on the table, something like "mytable"; and then add
a text element to the top of the report that is set to html and has
following code in it:
<script type="text/javascript">
function setWidth() {
var myTable = document.getElementById('mytable');
theTable.style.width = (document.body.clientWidth*.8) +'px';
}
setWidth();
</script>
Jason
On 2/4/2011 10:34 AM, alptugay wrote:
> Hello all,
> My problem is that I have a table with very long strings. These long
> strings doesn't fit the screen size, exceeds the screen size and
> therefore a horizontal scroll bar appears in the browser. I don't want
> to define a static length for the table, grid etc. Because it will
> differ from monitor to monitor. And %100 is not working as I want. So
> what I wrote a script in the report's beforafactory, afterfactory,
> beforerender, afterrender, onpagestart events. Because I don't know
> exactly in which event I shoul write it. Whatever the script is this:
>
> reportContext.getReportRunnable().designHandle.getDesignHand le().findMasterPage( "SimpleMasterPage").setProperty("width",screen.width+"px ")
>
>
> This script doesn't work. Whereas when I write it like the one below it
> works.
>
> reportContext.getReportRunnable().designHandle.getDesignHand le().findMasterPage( "SimpleMasterPage").setProperty("width",1440+"px")
>
>
> Some friends may say that masterpage doesn't accept "px" and that It
> only accepts metric units. Actually it works, because the second script
> is functionin normally. But Fyi I have also tried writing "mm" instead
> of "px" still the same. The first one works the second one doesn't.
>
> I am using designer 2.5.2 and reportviewer 2.6.1
>
> Any ideas why screen.width doesnt work?
|
|
|
Powered by
FUDForum. Page generated in 0.02160 seconds