conditional column summary

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

conditional column summary

Postby skywalker » Mon Dec 16, 2013 12:41 pm

I'm using an Aggregate table and I want a certain column summary to be displayed only in another column of the table has been grouped. I didn't find a direct API to tell if a column is grouped so I wrote the method below. However how do I alter the summary function to disable summary based on the grouping? Is TableModelListener the right place where I call setSummaryType(PivotConstants.SUMMARY_NONE) on the field if isColumnFooGrouped() returns true?

Code: Select all
private boolean isColumnFooGrouped() {
    int groupColumnCount = aggregateTableModel.getGroupColumnCount();
    for(int i = 0; i<groupColumnCount; i++) {
        int groupColumn = aggregateTableModel.getGroupColumnAt(i);
        String columnName = actualModel.getColumnName(groupColumn);
        if("foo".equals(columnName)) {
            return true;
        }
    }
    return false;
}


Thanks,
Sanjiv
skywalker
 
Posts: 204
Joined: Sat Jun 30, 2012 10:17 am

Re: conditional column summary

Postby JIDE Support » Mon Dec 16, 2013 1:20 pm

Your code fraction need a little bit modification to be more accurate. Each grouping/ungrouping operation will fire table structure changed event from AggregateTableModel so you can listen to that event and check this method you provided.
Code: Select all
private boolean isColumnFooGrouped() {
    int groupColumnCount = aggregateTableModel.getGroupColumnCount();
    for(int i = 0; i<groupColumnCount; i++) {
        int groupColumn = aggregateTableModel.getGroupColumnAt(i);
        String columnName = aggregateTableModel.getActualModel().getColumnName(groupColumn);
        if("foo".equals(columnName)) {
            return true;
        }
    }
    return false;
}

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: conditional column summary

Postby skywalker » Mon Dec 16, 2013 1:44 pm

I was saving the actual model as a member variable but your suggestion of using aggregateTableModel.getActualModel() is better. The solution works, thanks.
skywalker
 
Posts: 204
Joined: Sat Jun 30, 2012 10:17 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 11 guests

cron