Jump to content
We've recently updated our Privacy Statement, available here ×

Jaspersoft iReport 5.2.0 how to use sort component


patrick.dewitt

Recommended Posts

Hi,

I have tried to use the sort component in iReport using a straight forward report of customers (detail and header). I pulled the sort component into the header and assigned the column to a field in the report. I then previewed the report. I saw no sort component on the report, so I couldn't sort the output.

Can anyone tell me when I should see it? Maybe you can't see it in the preview. I have tried all kind of options but it didn't do it.

Kind regards,

Patrick

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Hi Patrick,

I just used the sort component myself. What I find out is that it didn't work in iReport (both with internal preview and HTML preview), but it did on the JasperReports Server.  Try deploying your report to JRS and run it there, then the sort component should work. BUT: in my report the sort component didn't show at start; however when I hovered on the place it shoul be, there was a blank space with hyperlink and after I clicked on it, the report content got sorted and the sort arow did show.

 

Regards,

Peter

Link to comment
Share on other sites

Hi Peter,

I have solved it. The sort component has three phases. The first phase is "Not sorted" and therefore shows no symbol. The second phase is "Sorted ascending" with the arrow up. The third phase is "Sorted descending" with the arrow down. After the third phase, the first phase starts again and there is no symbol again.

I have made the sort component the same hight and a little bit wider then the header of the column. Position the sort component on top of the header of the column. Then unmark the property "Opaque" so that it will be transparant and you will see the header. Next you have to set the property "Handler Horiz. Align." to the value "Right".

If you now publish the report to the repository and run it, you can click on the header itself, activating the sort component.

Thank you again Peter for giving me comments to go further.

Kind regards,

Patrick

Link to comment
Share on other sites

Hello to you both,

This post (and Peters) was very helpful and we have succeeded in finally using the sort component.

Have either of you explored formatting the symbol size or style? We would like to remove the border and make it a little smaller.

Also, any thoughts on a way to force the element to only sort the current column? By that we mean, if you have three columns and the initial sort is column 1 "Sorted ascending", then when we click column 3, the sort on column 1 changes to "Not Sorted" and column 3 changes to "Sorted ascending" leaving us with only a single column sort.

 

Gary

Link to comment
Share on other sites

Hi Gary,

I am glad that it helped you.

I have 3 columns with a sort component.

  1. Click on column 1, column 1 gets sorted ascending, leaving column 2 and 3 unsorted
  2. Click on column 2, column 2 gets sorted ascending within column 1, leaving column 3 unsorted
  3. Click on column 3, column 3 gets sorted ascending within column 2 and column 1

In this order I got no problem at all. But now if I click on column 1, it looks like column 1 is not in the lead anymore, but follows column 2 and 3 in that order.

With this answer, which is not totally an answer to your question, I showed my experience with it. It does work for me as long as I am in step 1 through 3. It doesn't work as properly as it should.

Now about the symbol I have the following. I have changed some options, symbol style, color, and it did change within iReport, but you don't see it getting changed when you publish it to the server. Although I can see it in the XML that it has been changed correctly, it doesn't show. I think that somehow on Jaspersoft Server gets interpeted in the wrong way and gets the defaults. I will try some more, but it will take some more time to figure it out. I will let you know if I find anything.

Kind regards,

Patrick

Link to comment
Share on other sites

Hi Gary,

One more thing about the sort component. Look at the sort components if they are overlapping with each other. My second sort component seem to be overlapping a little bit with the first and now the first is gone for a piece of a second and comes up again. Maybe if the overlap is too much you won't see it at all anymore.

Kind regards,

Patrick

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...