79720897

Date: 2025-07-31 07:02:02
Score: 1
Natty:
Report link
const onGridReady = (params) => {
  setTimeout(() => {
    const inputs = document.querySelectorAll('.ag-floating-filter-input input[type="text"]');
    inputs.forEach((input) => {
      if (!input.placeholder || input.placeholder === '') {
        input.placeholder = 'Contains';
      }
    });
  }, 300);
};

I want to add default placeholder text to AG Grid's floating filter input fields. I've developed the following code that sets a "Contains" placeholder for all empty text input fields after the grid loads.

A setTimeout is used because AG Grid needs a moment to fully render its DOM. This code should be added to the onGridReady event.

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: swapnil mohan shende