An interesting problem was forwarded to me. An Active Report needed to have a data checkbox prompt wrap around. In some scenarios there were too many values for a simple horizontal prompt, and the vertical prompts wouldn’t fit at all. The solution is fairly simple, and you can jump to the end of the article if you don’t care about how I found it.
Horizontal radio and checkbox prompts are actually single row tables with multiple cells. Tables are notoriously difficult to reposition with CSS, and there’s precious little in the HTML that we could use to style.
Next let’s look at a vertical prompt. I figured it would be built similar to the horizontal, a table with one cell and multiple rows. In fact, a vertical checkbox prompt is actually that.
Oddly a vertical radio prompt is a series of divs.
And each of those divs has a class associated, clsListItem_normal, with it. This makes it possible for us to play with local classes. Normally, we should be able to simply create a class with the same name. Unfortunately some wise-guy in the RS dev team decided to make life difficult. The RS local class gui gives us an error message when we try to create a class name containing an underscore. So we need to get clever.
Currently IE is the only browser that allows Report Studio to work with the system clipboard. So save your report and reopen in IE (unless you’re already using IE for report development, you poor schlub). Remember to click “allow” if it asks you for permission to access the clipboard.
Now, instead of changing the name of the class, cut the class into notepad, and change the class name there. Paste it back into the local class and voila, we have found away the silly and arbitrary “no underscores” rule.
<RSClipboardFragment version="2.0"><classStyle name="clsListItem_normal"/></RSClipboardFragment>
Now, let’s set the box type on the class to inline, and right margin to 10px, and run the report.
My experiments show that the wrapping radio buttons will continue to work across browsers and platforms. Unfortunately this will not work with checkbox prompts, until they are changed to divs instead of tds.
The attached report is based on 10.2.2. I’m not sure how the radio prompts are built in previous versions. In any event, 10.2.2 is the first version since 8.2 that allows you to actually set the class name instead of just the class label. So you’ll need to use the copy/paste technique anyway.
wrapping-radios.txt (438 downloads)