jbo_master Posted July 16, 2009 Share Posted July 16, 2009 hello all,Is it right that we can override the sorting order of a row or column group of a crosstab by a comparator expression?If we can,does anyone of you guys have an working example of such a "comparator expression"?Thanks for your help Link to comment Share on other sites More sharing options...
hq4ever Posted July 20, 2009 Share Posted July 20, 2009 This is 1:1 my problem. I would love to hear someone with a working example Link to comment Share on other sites More sharing options...
dfreis Posted November 17, 2009 Share Posted November 17, 2009 had exactly the same problem.Found a 'quite hacky' solution using a Comparator and an Object[] as expression (see code)and use:"((Object[])$V{"+nameOfYourRowGroup+"})[0]"as the expression text of your header Cell.hope you got the idea,regardsDieter Code:JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();JRDesignExpression orderComparator = new JRDesignExpression();orderComparator.setValueClass(Comparator.class);orderComparator.setText("$P{Comparator}.getComparator()"); // or new MyComparator() ...bucket.setComparatorExpression(orderComparator);rowExpression.setText("new Object[] {$F{"+yourValueToDisplay+"}, $F{"+yourValueToOrder+"}}");rowExpression.setValueClass(Object.class); Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now