Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom parameter to ag-grid valueFormatter function

Tags:

ag-grid

Can i pass a custom parameter to ag-grid valueFormatter function like valueFormatter: percentageFormatter(params, '10')

If yes then what needs to be passed as first parameter to get the cell value?

like image 695
user3799300 Avatar asked Dec 23 '22 08:12

user3799300


1 Answers

Function

percentageFormatter(percentage: number) {
  return (params) => {
    //your code goes here
    //**EDIT** this return will be what you will see in ag-grid
    return params.value * percentage;
  }
}

Then, in your column definition:

valueFormatter: percentageFormatter(10)
like image 53
Rafael Andrade Avatar answered Dec 28 '22 05:12

Rafael Andrade