how to dynamically set the row height and column w

2019-07-06 18:27发布

问题:

I have used using this trying to fit the column and row width how to dynamically set the row height and column width in ag-grid(please provide git hub code in typescript)

回答1:

I am assuming that you want to set row height based on the content of a row.

step 1 : set getRowHeight property to a javascript function.

gridOptions.getRowHeight = rowHeightFn

step 2 : define rowHeightFn based on your requirement.

function rowHeightFn(params) {
   var result = 46;
   if (params.data.someKey === 2) {
      result = 2;
   }
   return result 
}