Right Outer Join

12 July 2012

Table Component – Customize Filtering & Sorting Icons

Filed under: JasperReports — mdahlman @ 16:54

Jaspersoft Interactive Reports

JasperReports Server 4.7 was released just this week. Among the most exciting features is the slew of improvements to the interactive reporting. First you create a report using the Table Component. Then the report will automatically be interactive when it’s deployed to JasperReports Server. The interactivity includes filtering, sorting, resizing, and hiding columns. Here’s an image of a sorted and filtered report:

Standard Filter Symbol ‘WHITE STAR’

That’s great… but why is filtering denoted by a star? I guess “☆” is reasonable enough. But can we do better? How can I change it to something better (or something just different)?

It turns out to be easily configurable. Edit WEB-INF/classes/jasperreports.properties, and add something like this:

# Use a fancy custom filter symbol
net.sf.jasperreports.components.filter.char=\u2704

Custom Filter Symbol ‘WHITE SCISSORS’

Get it? It’s a scissors to indicate that I “cut” some of the values out of the report. OK, I’m glad “✄” isn’t the default symbol, but I’m equally glad that it’s easy to use it if I want.

Here are a few alternative ideas in easy-to-copy-and-paste format:

# Ⓕ What could be more intuitive than 'CIRCLED LATIN CAPITAL LETTER F' to show filtering?
net.sf.jasperreports.components.filter.char=\u24BB

# 濾 How about the whole word 'strain out, filter' in a single symbol?
net.sf.jasperreports.components.filter.char=\u6FFE

For completeness I’ll mention that you can, of course, set the sort symbols as well. The choice of ‘BLACK UP-POINTING TRIANGLE’ is eminently reasonable. But it’s a touch dull. How is this for a snazzy update?

# Those triangles are dead boring. Hands are so much more personal.
net.sf.jasperreports.components.sort.up.arrow.char=\u261D
net.sf.jasperreports.components.sort.down.arrow.char=\u261F
net.sf.jasperreports.components.filter.char=\u2286

Why yes, that’s ‘SUBSET OF OR EQUAL TO’ and ‘WHITE UP POINTING INDEX’ (zoomed in for visibility)

The best reference source for Unicode characters is fileformat.info:

     more

By they way, the commercial edition of JasperReports Server 4.7 is out now. The community edition is not out yet. I don’t know when it’s coming. Soon, I hope.

Of course I was a bit overly dismissive when I wrote “”☆” is reasonable enough”. There was actually quite a bit of research by Jaspersoft engineering to make this choice. The ‘WHITE STAR’ character enjoys quite widespread support in popular fonts. So you are much more likely to find that your end users are seeing the intended character rather than a dreaded empty box symbol. Support for ‘WHITE SCISSORS’ is significantly less wide spread. That would have been a terrible default choice. But it’s important to know you can use whatever symbols you want.

Advertisements

3 Comments »

  1. Hi, Matt —
    I implemented a sortable table recently – it’s great! In one of my tables, however, I have hyperlinks. It seems like the hyperlinks get pushed behind the sort feature in the table. Do you know how I can tell the table to allow the hyperlinks, or not sort on certain columns, or push the hyperlinks to the surface? Thanks so much!

    Comment by Lisa Eaton — 23 July 2012 @ 11:10

  2. Hi mdahlman
    I am using jasper report library in my web application. How do i enable this interactive feature without using jasper server? Are there any way to integrate this advance viewer to my application

    Comment by ajmal — 8 September 2012 @ 00:37

    • That’s a good question. There’s not a “simple” way to enable interactivity outside of JasperReports Server. But that depends on your own definition of “simple”. The story goes like this:

      1. Design the report using a Table component.
      2. Deploy the report to JRS (Community Edition or a commercial edition) and it’s automatically interactive. (hooray!)

      But… that’s not the whole story. You can of course create your own web app to supply interactivity.
      And even that isn’t the whole story! JasperReports actually ships with a sample of enabling interactivity in a basic web application. Download the JR project with samples, and look for this sample:
      jasperreports-x.y.z/demo/samples/webapp-repo

      It’s a fully functional interactive viewer. It could be adapted to work in your own environment. So it’s clearly possible. And if you’re OK with doing this kind of development work… one might even call it “simple”.

      Comment by mdahlman — 10 September 2012 @ 09:20


RSS feed for comments on this post. TrackBack URI

Go on... leave a reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: