covalent icon indicating copy to clipboard operation
covalent copied to clipboard

Autosize columns

Open aciccarello opened this issue 8 years ago • 4 comments

Feature Request

With the implementation of virtual scrolling in the data table, it no longer will automatically size columns to the content because not all the cells in the column are displayed. The data table should have the ability to autosize columns based on the currently rendered cells.

What is the expected behavior?

  • The data table should have an autosize input
  • When the autosize input is truthy, the columns with no width setting will be set to fit the rendered cells
  • Autosize will resize columns with a min and max width setting within the defined bounds
  • autosize should not be applied on columns that have a set width that isn't a range

What is the motivation / use case for changing the behavior?

Ease of configuration. Improved sizing of table.

Other information

This feature is implemented in ag-grid

Related issues:

  • #1018 Data table no longer adjusting width automatically
  • #833 Responsive datatable
  • #701 Custom column widths
  • #739 Feature request for resizeable columns

aciccarello avatar Dec 14 '17 18:12 aciccarello

The problem with that is that as you keep scrolling the cell width would vary which would seem flaky to a user.. since not all rows are rendered..

Ive been thinking about this for a while and havent been able to come up with a proper solution.. cause we either have to disable the virtual scroll for this to work properly, or something that allows us to know the "max" width the content of a cell could have even if they are not rendered in the DOM

emoralesb05 avatar Dec 14 '17 23:12 emoralesb05

I was thinking that the autosize would only apply to the initial rows rendered. Basically you are using the first few rows as an approximation of the size of the content. If later rows are extra wide or extra small, the grid columns would not adjust.

aciccarello avatar Dec 14 '17 23:12 aciccarello

I was looking in the documentation for how to do this, but I see it's not implemented. It would be very useful if the tables had this functionality.

Meanwhile, I wanted to modify my css to make the columns fit the size of the content, but Covalent has added css code with !important and I couldn't override it. image

EduJGURJC avatar Jan 14 '19 08:01 EduJGURJC

this component is deprecated and will not be supported in future versions please use https://material.angular.io/components/table

owilliams320 avatar Jan 11 '22 16:01 owilliams320