2021-01-27

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));


from Recent Questions - Stack Overflow https://ift.tt/3a7BrLB
https://ift.tt/eA8V8J

1 comment:

  1. A few elements may make the item print clear pages, for example, print settings, low ink, or the actual item. Western Bright Cut Bracelets

    ReplyDelete