Layout of DataTable with groups + alternating rowStyles looks really bad
------------------------------------------------------------------------

                 Key: TOMAHAWK-913
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-913
             Project: MyFaces Tomahawk
          Issue Type: Improvement
          Components: Extended Datatable
    Affects Versions: 1.1.3, 1.1.5-SNAPSHOT
            Reporter: Paul Palaszewski
            Priority: Minor


Hi!

I'm using Extended Data Tables and wanted to use the column's groupBy. Now all 
normal tables of this project have rowStyles with alternating 
row-background-colors, so I tried to apply them also on the grouped data. It 
looks really bad, since the generated row-span messes up the layout.

The rowGroupStyle does not help - it's only useable as group separator style, 
therefor I think the name is a litte bit confusing - but that's another issue.

I suggest, that the rowStyles should work on groups rather than on rows. Tried 
to patch HtmlTableRenderer accordingly and works fine for me:

HtmlTableRenderer#createColumnInfos
[..]
        int currentRowSpan=-1;
        int currentRowInfoIndex=-1;
        int groupCount = 0; // added by PP

        TableContext tableContext=htmlDataTable.getTableContext();
[..]
            if(groupEndReached)
            {
                currentRowSpan=0;
                groupEndReached = false;
                groupCount++; // added by PP 
            }
            rowInfo.setGroupIndex(groupCount); // added by PP
            tableContext.getRowInfos().add(rowInfo);

HtmlTableRenderer#renderRowStyle
        String rowStyleClass;
        String rowStyle;
        if (uiData instanceof HtmlDataTable)
        {
            HtmlDataTable datatable = (HtmlDataTable) uiData;
            rowStyleClass = datatable.getRowStyleClass();
            rowStyle = datatable.getRowStyle();
// added by PP            
            TableContext tableContext = datatable.getTableContext();
            if (tableContext != null && tableContext.getRowInfos() != null && 
tableContext.getRowInfos().size() > rowStyleIndex) {
                    RowInfo rowInfo = (RowInfo) 
tableContext.getRowInfos().get(rowStyleIndex);
                    if (rowInfo.getGroupIndex() >= 0) rowStyleIndex = 
rowInfo.getGroupIndex();
            }

RowInfo added
        private int _groupIndex = -1;

        public int getGroupIndex() {
                return _groupIndex;
        }
        
        public void setGroupIndex(int groupIndex) {
                _groupIndex = groupIndex; 
        }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to