Search code examples
angulartypescriptnumberscellag-grid

How to Customize Number Input Type Cell ag-grid


I do have input columns in my ag-grid which should accept only number type values.

   ngOnInit(): void {

        this.columnDefs = [
 {
            headerName: 'Header', field: 'quantity',
            cellRendererParams: params => {
              return {
                inputType: 'number'
              };
            }
          }
    ];

When using the above approach, the behavior is as expected, but 2 arrow buttons (up and down) are added in the cell which can increase or decrease the current value by one.

I can't figure out how to remove this buttons, since no reference of these could be found.

Is there any other approach? or, how can these buttons be removed?


Solution

  • by css you can try

    input[type=number]::-webkit-inner-spin-button, 
    input[type=number]::-webkit-outer-spin-button { 
      -webkit-appearance: none; 
      margin: 0; 
    }
    

    but still working mouse wheel to increment/decrement number