phantom TableStubCell when setting dynamic column widths
- [x ] I have searched this repository's issues and believe that this is not a duplicate.
I'm using ...
- [x ] React Grid
- [ ] React Chart
- [ ] React Scheduler
Current Behaviour
I'm attempting to set the column widths to be dynamic, so that the table is more responsive. However, when I change the column widths from pixels to a percentage, it sort of works but the table renders with an extra column on the far right side. Via inspecting the element, it appears to add a "TableStubCell" element to the table. I have no idea where that came from.
Expected Behaviour
It's supposed to render the table with the columns I set in state, without an extra columns or cells.
Steps to Reproduce
a few relevant pieces of code
columnWidths: [
{ columnName: 'isActive', width: '5%' },
{ columnName: 'name', width: '15%' },
{ columnName: 'userId', width: '15%' },
{ columnName: 'contactName', width: '15%' },
{ columnName: 'email', width: '15%' },
{ columnName: 'city', width: '15%' },
{ columnName: 'state', width: '15%' },
{ columnName: 'menu', width: '5%' },
],
cell = ({ column, style, tableRow, value }) => {
const { row: { isActive, isSuspended, isSkeletonRow }} = tableRow;
if (isSkeletonRow) {
return <Table.Cell style={style}>{value}</Table.Cell>;
}
let content = value;
if (column.name === 'menu') {
content = this.renderMoreMenu(tableRow);
} else if (column.name === 'isActive') {
let className = 'active-';
let title = '';
if (!isActive) {
className += '3';
title = 'Inactive';
} else if (isSuspended) {
className += '2';
title = 'Suspended';
} else {
className += '1';
title = 'Active';
}
content = <Tooltip title={title} placement={'left'}>
<CheckIcon className={className} />
</Tooltip>;
}
return <Table.Cell style={style}>{content}</Table.Cell>;
};
render(){
<Grid
rows={rows}
columns={columns}
getRowId={this.getRowId}
>
<TableFilters
addLink={addLink}
changeFilters={this.changeFilters}
filterByOptions={filterByOptions}
initialValues={initialValues}
searchByOptions={searchByOptions}
title={title}
/>
{filterByOptions && <IntegratedFiltering />}
<SortingState
sorting={sorting}
onSortingChange={this.changeSorting}
/>
<PagingState
currentPage={currentPage}
onCurrentPageChange={this.changeCurrentPage}
pageSize={pageSize}
onPageSizeChange={this.changePageSize}
/>
<IntegratedSorting />
<IntegratedPaging />
<DragDropProvider/>
<Table
style={{ width: 'auto', tableLayout: 'auto' }}
columnExtensions={tableColumnExtensions}
cellComponent={this.cell}
/>
<TableColumnReordering
order={columnOrder}
onOrderChange={this.changeColumnOrder}
/>
<TableColumnResizing
columnWidths={columnWidths}
onColumnWidthsChange={this.changeColumnWidths}
/>
<TableHeaderRow
showSortingControls
/>
<PagingPanel pageSizes={pageSizes} />
</Grid>
}
Environment
- devextreme-reactive: see above
- react: 16.6.0
- browser: chrome
- bootstrap: none
- react-bootstrap: none
- material-ui: see above
Hi @smcalilly,
The TableColumnResizing plugin supports two resizing modes. The 'widget' mode is used by default. In this mode an additional flexible column is rendered, which allows expanding the last column. If you don't need to change the summary width of columns, you can use the 'nextColumn' mode as follows:
<TableColumnResizing
columnWidths={columnWidths}
onColumnWidthsChange={this.changeColumnWidths}
resizingMode="nextColumn"
/>
Also, we have a demo illustrating the difference between these modes. If you have any further questions, let us know.
@LazyLahtak so the resizingMode="nextColumn" makes it so the phantom column doesn't render? Seems simple, but I can't seem to make that work.
@LazyLahtak It seems that all of y'alls tables behave like that, where there's huge extra space on the far right. Can we reopen this as a bug or a feature request, to fix that? I'm not sure that's the best behavior for UI...it looks weird.
@smcalilly,
Could you please provide us with your code or a runnable project (for example, in CodeSandbox)? This will help us solve this problem.
The Table is distributed over the container's width. Empty space is filled with stub cells with the same formatting. Without them, the table will look like this:

What behavior do you expect?
I don't understand why the table adds the empty space? If the table has four columns, like the one above, shouldn't it just go all the way to the edge of the container?
@smcalilly,
The screenshot above shows an example when all columns have fixed width and the summary width is less than the container width. In this case, the table has some empty space filled with stub cells.
When at least one column has an auto or no fixed width, it occupies all the container. Several such columns fill the container by equal parts.
I've not found en example when a table, whose width is equal or bigger than the container width, renders stub cells. Could you specify the demo to which you referred or provide an example to us?
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
In your sandbox example, it shows a Stub column even if resizingMode is set to 'nextColumn' initially. This is not the behaviour you've described earlier. According to your response, it supposes to render it only in 'widget' mode. So, the question is still there, how can we avoid having Stub columns in 'nextColumn' resize mode.
@eugenehdev6,
If all columns have fixed width, the table adds stub cells. Stub cells fill the empty space between last data cells and the end of the table to apply certain styles for the empty space. Below is an example without stub cells. Note that the sandbox example in the comment is a fork of our demo, which I asked you to modify to reproduce the issue.
When at least one column width is auto or non-fixed (even without the TableColumnResizing plugin), the table doesn't render stub cells. Please refer to the example and screenshot below.
If you have any further questions, feel free to open a new issue.

@LazyLahtak THank you for the provided demo and clarification.