2017-03-15 7 views
0

私は以下のように列定義を定義している:どのように自動角度UIグリッドの最後の列のサイズを変更する

$scope.gridOptions = { 
enableColumnResizing: true, 
    columnDefs : [ 
     {displayName : "Name", field : "name", width : '200'}, 
     {displayName : "Gender", field : "gender" , width:'300'}, 
     {displayName :"Address",field:"address",width:'400'} 
    ] 
}; 

期待が、私は列のサイズを変更場合は、最後の列は、グリッドの残りの幅に合わせて調整すべきであるということです。

答えて

0
By removing last column width or setting last column width to '*' will resolve the issue. 
But the whitespace problem arises if we resize the last column. 
So to avoid whitespace problem you have to approaches: 
1)You have to disable resizing on the last column 

$scope.gridOptions = { 
enableColumnResizing: true, 
    columnDefs : [ 
     {displayName : "Name", field : "name", width : '200'}, 
     {displayName : "Gender", field : "gender" , width:'300'}, 
     {displayName :"Address",field:"address",width:'*',enableColumnResizing:false} 
    ] 
}; 

Or 
2) set the width of the previous column to '*' dynamically. 


$scope.gridOptions = { 
enableColumnResizing: true, 
    columnDefs : [ 
     {displayName : "Name", field : "name", width : '200'}, 
     {displayName : "Gender", field : "gender" , width:'300'}, 
     {displayName :"Address",field:"address",width:'*'} 
    ] 
}; 

If you want to resize the last column set the width of "gender" column to '*' using some JS snippet.