Last column to take the available space so no space nor horizontal scrollbar will appear

Hi

I have a grid with 4 columns. I want to auto size them but I also want the last column to occupy only the rest of the available space. meaning I don't want the horizontal scrollbar to appear nor a white space between the last column and the vertical scrollbar.

The following is an example when I tried to autowidth the columns. The whitespace is between the last column and the vertical scrollbar.

Notice that the grid/column is doing exactly what I ask regarding width and autowidth, so this is not a bug, my question is if and how I can make the last column behave "differently".

Bonus question: is there a way to css the scrollbar so it will look differently?
Thanks

7 Replies

AG Ajith Govarthan Syncfusion Team April 30, 2020 01:22 PM UTC

Hi Amos, 

Thanks for contacting Syncfusion support. 

Based on your query we suspect that the white space has been generated between the last column and the vertical scrollbar at initial rendering of grid. To proceed with your query we need the following details, 

1. Share the complete Grid code example. 

2. Have you used autoFitColumns method of EJ2 to autofit the columns? 

3. Is the white space is generated at initial rendering of grid or after applied any operation on Grid?  

4. Syncfusion Package Version. 

Please provide the details it will help us to find out the better solution. 

Regards, 
Ajith G. 



AM Amos April 30, 2020 01:41 PM UTC

Hi Ajith,

Correct, the white space occurs as a result of
this.$refs.gridObj.autoFitColumns([]);
This is working as expected.

Instead of autosize, I want it to behave in such way, so no horizontal bar will appear (in case it's too wide for the grid) nor a white space
until the scrollbar (in case it's too narrow for the grid, as shown in the screenshot).

In other components it is called "column auto width" (NOT column auto size), meaning "specifying whether column widths are automatically
modified so that the total columns' width matches the grid/View's width.

Read here as an example:
https://docs.devexpress.com/WindowsForms/DevExpress.XtraGrid.Views.Grid.GridOptionsView.ColumnAutoWidth
Thanks


PK Prasanna Kumar Viswanathan Syncfusion Team May 5, 2020 08:12 AM UTC

Hi Amos, 
 
Thanks for the update. 
 
Based on your update you have mentioned that the white space occurs when you call the autoFitColumns method of EJ2 Grid. So, we have created an sample with four columns and when we call the autoFitColumns method in the dataBound event the white space does not occur in our sample. 
 
For your convenience we have attached the sample and please find the sample from the below link 
 

To find the out the root cause of an issue we need the following details, 

1. Share the complete Grid code example and also please share the details that where you have define autoFitColumns method in the grid. 
 
2. Have you define any width for the grid control? 
 
3. Have you render the grid inside any control? 
 
4. If possible please replicate the issue in the attached sample. 
 
Regards, 
Prasanna Kumar N.S.V 



AM Amos May 5, 2020 08:25 AM UTC

Hi

There's a misunderstanding. My post here is not about a bug but a new(?) feature.
autoFitColumns works as expected and the columns are autowidth based on their content.
In my case, sometimes the width (of the 4th column) is too wide causing an horizontal scrollbar to appear
and sometimes the width (of the 4th column) is too narrow causing the whitespace to appear.

Instead of autoFitColumns I want "columns auto width" (NOT column auto it), meaning "specifying whether column widths are automatically modified so that the total columns' width matches the grid/View's width. = no whitespace and now horizontal scrollbar.

I hope this time it is clearer



AG Ajith Govarthan Syncfusion Team May 7, 2020 01:59 PM UTC

Hi Amos, 

Thanks for the update. 

Based on your request we have consider “columns auto width” property in columns API as a feature request and logged this “Provide support for columnAutowidth in the EJ2 Grid ” as feature task. 

You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 


Regards,
Ajith G. 



AM Amos May 7, 2020 04:09 PM UTC

Again thank you very much for your support and for your willing to hear your users :)


AG Ajith Govarthan Syncfusion Team May 8, 2020 01:18 PM UTC

Hi Amos, 

We will let you know once the feature has been included. 
 
Until then we appreciate your patience. 

Regards, 
Ajith G. 


Loader.
Up arrow icon