How set auto width for column ?
Hi! How set auto width for column(s) ?
columnDef = [ { field: 'name', minWidth: 100, width: 'auto'}, { field: 'age', minWidth: 20, width: 'auto'} ]
You can set '*' width, there is no auto width function.
May be exist equivalent "double click" on line (between columns) ? to resize a content in column.
I tried '*', didnt work for me..
And even I set width to "auto" or "*" and column have auto-size, the column brings to fixed width after any column in grid was resized manually...
i believe that "*" not working, could you please help us for this point @PaulL1
It is working for me, based on what I want to do. What is it you are trying to do?
This set columns 1 and 3 to the size I wanted and filled the rest of the grid width with column 2
columnDefs: [
{field: 'col1', displayName: 'Column 1', width: 175},
{field: 'col2', displayName: 'Column 2', width: '*'},
{field: 'col3', displayName: 'Column 3', width: 120}
],
It's not working to me
columnDefs: [ {field: 'col1', displayName: 'Column 1', width: 175}, {field: 'col2', displayName: 'Column 2', width: '*'}, {field: 'col3', displayName: 'Column 3', width: 120} ],
It is not working for me as well.
I have tried the same: columnDefs: [ {field: 'col1', displayName: 'Column 1', width: 175}, {field: 'col2', displayName: 'Column 2', width: '*'}, {field: 'col3', displayName: 'Column 3', width: 120} ],
I have also tried: columnDefs: [ {field: 'col1', displayName: 'Column 1', width: 175}, {field: 'col2', displayName: 'Column 2', width: "*"}, {field: 'col3', displayName: 'Column 3', width: 120} ],
This doesn't seem to be working for me either. Is there a way to get the grid columns to automatically size themselves to the width of the content in the column?
This is still not working for me too
Hi there, this issue is still alive. So I just have a quick question: when will this fix ship in UI-Grid? Thanks in advance!
Hi, Is there any solution for auto size column now.
+1 Not working
+1 Not working...pretty annoying. We'll need to put some CSS to do the trick?
+1 Not working... Hello guys, any news about?
Its a number property. Wouldn't assign string to it.
So What? :D
Hello Friends,
Actually I was trying to find a solution for this till our friends in ui-grid team find one.. I used a css class to force the cell auto size with max content.. class should be like this:
Update I found some issues with width max-content solution. I applied the same grid solution for chrome
.ui-grid-cell-contents-auto {
/* Old Solution */
/*min-width: max-content !important;*/
/* New Solution */
display: grid;
grid-auto-columns: max-content;
/* IE Solution */
display: -ms-grid;
-ms-grid-columns: max-content;
}
then you should use the property cellClass in ui-grid columns object to enable this class on your grid (something like this):
columns: [{ field: 'search_name', displayName: '', cellClass: 'ui-grid-cell-contents-auto'}]
--
I updated this to include a solution for IE browser which doesn't support max-content value for width property
@nekhaly can you specify what would ui-grid-name-step will contain?
@ashaik27 sorry.. I updated it.. It should be the class name I defined above.. Thank you for the notice :)