gwt-material-table icon indicating copy to clipboard operation
gwt-material-table copied to clipboard

BaseRenderer#drawRow does not consider column offset

Open GuidoReith opened this issue 5 years ago • 1 comments

Having a AbstractDataView (selectionType is not SelectionType.NONE); Turn off some columns and sort the rest gives wrong result: AbstractDataView#renderRows:337 - setting visible header indexes by method getVisibleHeaderIndexes(); AbstractDataView#getVisibleHeaderIndexes:307 - uses getColumnCount() method; AbstractDataView#getColumnCount:1275 - returns column count without OFFSET (getColumnOffset()); BaseRenderer#drawRow:135 - drawColumn() method uses as param isHeaderVisible() method with column index without OFFSET (int c);

Fix could be: Change in getVisibleHeaderIndexes():

        protected List<Integer> getVisibleHeaderIndexes() {
		List<Integer> visibleHeaders = new ArrayList<>();
		for (int index = 0; index < getColumnCount() + getColumnOffset(); index++) {
			if (isHeaderVisible(index)) {
				visibleHeaders.add(index);
			}
		}

		return visibleHeaders;
	}

In BaseRenderer#drawRow:135 TableData td = drawColumn(row, context, data, column, colIndex, isHeaderVisible(colIndex));

GuidoReith avatar Jan 27 '21 14:01 GuidoReith

Thanks for reporting, I'll take a look at this

BenDol avatar Jan 27 '21 15:01 BenDol