The Resize Columns feature allows each column to be resized.
To enable, you must include the 'ui.grid.resizeColumns' module and you must include the ui-grid-resize-columns directive on your grid element.
Documentation for the resize column feature is provided in the api documentation, in particular:
You can set individual columns to not be resizeable, if you do this it is recommended that those columns have a fixed pixel width - otherwise they may get automatically resized to fill the remaining space if other columns are reduced in size, and there will be no way to reduce their width again.
When you resize a column any other columns with fixed widths, or that have already been resized, retain their width. All other columns resize to take up the remaining space. As long as there is at least one variable column left your columns won't reduce below the full grid width - but once you've resized all the columns then you can end up with the total column width less than the grid width.
angular.module('yourApp', ['ui.grid', 'ui.grid.resizeColumns']);
<div ui-grid="gridOptions" class="grid" ui-grid-resize-columns></div>
$scope.gridOptions = { enableColumnResizing: false };
enableColumnResizing
property to false in its column definition.
$scope.gridOptions = { enableColumnResizing: true, columnDefs: [ { field: 'name' }, { field: 'gender', enableColumnResizing: false }, { field: 'company' } ] };
For better performance with the following example, you can choose to load the ui-grid.core.js and specific feature files instead:
<script src="/release/ui-grid.core.min.js"></script> <script src="/release/ui-grid.resize-columns.min.js"></script> <script src="/release/ui-grid.move-columns.min.js"></script>