Ag-Grid agNumberColumnFilter Is Not Working with Calculated Values in valueFormatter

I have an ag-grid in angular project. I have set the column def as:

this.columnDef.push(
  headerName: col,
  field: col,
  valueFormatter: setMyValue,
  filter: 'agNumberColumnFilter',
  filterParams: { valueFormatter: setMyValue }
)

function setMyValue (params) {
  return params.value.toFixed(2); // OPTION #1 WORKS 
  //let temp = params.value * 100;
  //return temp.toFixed(2); // OPTION #2 DOES NOT WORKS 
}

OPTION #1: this logic works in the ag-grid and i am able to correcly filter using equal, great then etc. OPTION #2: this logic does not work, when i enter any number in filter, it returns empty rows.

What I have tried:

I have tried to bind the function to component:

valueFormatter: setMyValue.bind(this)

and I also tried to force the return value to number as :

return parsInt(temp.toFixed(2));
David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article