Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Toggle table visibility
Toggle table visibility [message #138405] Thu, 02 March 2006 14:33 Go to next message
Eclipse User
Originally posted by: dave.gross.logiclibrary.com

I want to toggle the visibility of a table in my report by clicking on a
button of some sort. I stole the idea from the viewer which uses a "+" or
"-" twisty-type "control" to expand and contract the error messages. E.g.,
in a Text (HTML/Dynamic) item:

<span id="twisty_01" style="cursor:pointer"
onclick="if (document.getElementById('content_01').style.display == 'none')
{
document.getElementById('twisty_01').innerHTML = '-';
document.getElementById('content_01').style.display = 'block';
} else {
document.getElementById('twisty_01').innerHTML = '+';
document.getElementById('content_01').style.display = 'none';
}" > + </span>
<pre id="content_01" style="display:none;" >Hide Me!</pre>

That works great. But how do the same thing for a table? I'm new to this
object model and don't understand how to get a handle to my table and then
manipulate its properties.

Thanks,
-- Dave
Re: Toggle table visibility [message #138579 is a reply to message #138405] Thu, 02 March 2006 17:27 Go to previous messageGo to next message
Eclipse User
Originally posted by: vladperl.semanticprogrammer.org

Check out visibility property in Property Editor - Table

you could use value of parameter to define visibility of table

example:

params["groupingBySite"]
Re: Toggle table visibility [message #138635 is a reply to message #138579] Thu, 02 March 2006 18:56 Go to previous messageGo to next message
Eclipse User
Originally posted by: dave.gross.logiclibrary.com

"Vladimir" <vladperl@semanticprogrammer.org> wrote in message
news:du7ret$esu$1@utils.eclipse.org...
> Check out visibility property in Property Editor - Table
>
> you could use value of parameter to define visibility of table
>
> example:
>
> params["groupingBySite"]
>
>
Yes, I know that works. I am trying to avoid bringing up a property dialog
to change the visibility. If there is a way to get at the property from my
HTML javascript snippet and set the property, I'd be willing to try that.
Any ideas?

Thanks,
-- Dave
Re: Toggle table visibility [message #139004 is a reply to message #138635] Fri, 03 March 2006 12:09 Go to previous messageGo to next message
Eclipse User
Originally posted by: vladperl.semanticprogrammer.org

> Yes, I know that works. I am trying to avoid bringing up a property
> dialog to change the visibility. If there is a way to get at the property
> from my HTML javascript snippet and set the property, I'd be willing to
> try that. Any ideas?

I don't know the best way to do it.
One idea - to use global java script variable.
You could define value of the variable using your snippet.

I'd like to know your solution in case you will have one.

Tnank you,
Vladimir
Re: Toggle table visibility [message #139015 is a reply to message #138405] Fri, 03 March 2006 12:17 Go to previous messageGo to next message
Eclipse User
Originally posted by: dave.gross.logiclibrary.com

Here is my solution.

1. I set an ID for the table by setting the Bookmark property to a quoted
value ('my_table').

2. Created a custom style called "Toggle Visibility" and set the Text
Block/Display property to None.

3. Set the style on my table to this new style.

4. Created a Text/(HTML/Dynamic) field in a cell with the following
contents:

<span id="twisty_01" style="cursor:pointer"
onclick="if (document.getElementById('my_table').style.display == 'none')
{
document.getElementById('twisty_01').innerHTML = '-';
document.getElementById('my_table').style.display = 'block';
} else {
document.getElementById('twisty_01').innerHTML = '+';
document.getElementById('my_table').style.display = 'none';
}" > + </span>

-- Dave
Re: Toggle table visibility [message #139113 is a reply to message #139015] Fri, 03 March 2006 15:04 Go to previous messageGo to next message
Eclipse User
Originally posted by: vladperl.semanticprogrammer.org

> Here is my solution.
>
> 1. I set an ID for the table by setting the Bookmark property to a quoted
> value ('my_table').
>
> 2. Created a custom style called "Toggle Visibility" and set the Text
> Block/Display property to None.
>
> 3. Set the style on my table to this new style.
>
> 4. Created a Text/(HTML/Dynamic) field in a cell with the following
> contents:
>
> <span id="twisty_01" style="cursor:pointer"
> onclick="if (document.getElementById('my_table').style.display == 'none')
> {
> document.getElementById('twisty_01').innerHTML = '-';
> document.getElementById('my_table').style.display = 'block';
> } else {
> document.getElementById('twisty_01').innerHTML = '+';
> document.getElementById('my_table').style.display = 'none';
> }" > + </span>

Thank you Dave for sharing.
If I will see the way to make that solution simpler I'll let you know.
I'm sure that very soon I will need to use that functionality.
Re: Toggle table visibility [message #249635 is a reply to message #139015] Tue, 24 July 2007 18:11 Go to previous messageGo to next message
Alex Krücken is currently offline Alex Krücken
Messages: 8
Registered: July 2009
Junior Member
Dave Gross pravi:
> Here is my solution.
>
> 1. I set an ID for the table by setting the Bookmark property to a quoted
> value ('my_table').
>
> 2. Created a custom style called "Toggle Visibility" and set the Text
> Block/Display property to None.
>
> 3. Set the style on my table to this new style.
>
> 4. Created a Text/(HTML/Dynamic) field in a cell with the following
> contents:
>
> <span id="twisty_01" style="cursor:pointer"
> onclick="if (document.getElementById('my_table').style.display == 'none')
> {
> document.getElementById('twisty_01').innerHTML = '-';
> document.getElementById('my_table').style.display = 'block';
> } else {
> document.getElementById('twisty_01').innerHTML = '+';
> document.getElementById('my_table').style.display = 'none';
> }" > + </span>
>
> -- Dave
>
>
I tried your solution (in Birt2.2) and it works only if I set the
Block/Display property of "Toogle Visibility" style to "Block" at the
beginning. When I do that, the situation is as follows: When I run the
report, I see the plus/minus sign and table. When I click on the
plus/minus sign, the table disapears, when I click it again, the table
shows it self again. So far so good.

But when I set the Block/Display for "Toogle Visibility" style to "None"
by default (in Edit Style) and then run the report, the situation is
as follows: I see the plus/minus sign and no table (this is also good so
far). But when I click the plus/minus sign nothing happens. The table
doesn't show. It looks as if the block/display property must be set to
"block" at the beggining, or else the table isn't generated at all and I
can't modify its propertys afterwards. Am I missing something?

Alex
Re: Toggle table visibility [message #683796 is a reply to message #249635] Tue, 14 June 2011 08:44 Go to previous message
Mike Wulkan is currently offline Mike Wulkan
Messages: 141
Registered: July 2009
Senior Member
I tried this for a chart and it works great; I would like to associate some labels and text fields with the toggle as well. I thought that this would be a simple matter of putting these fields in a grid and then setting the grid's style to the ToggleVisibility style. Then I manipulated the grid's style in the onclick handler just as I do for the chart.

The chart (and twisties) display/not display correctly but the grid and it's contents never display.

Any ideas would be appreciated.

Mike
Previous Topic:Where to put a function that is referenced in a master page?
Next Topic:(no subject)
Goto Forum:
  


Current Time: Thu Aug 21 16:16:30 EDT 2014

Powered by FUDForum. Page generated in 0.01632 seconds