Ag-Grid agTextColumnFilter defaultOption

Ag-Grid agTextColumnFilter defaultOption

I have to set default value to ag-grid agTextColumnFilter. I order to do that I I added filterParams and defaultOption, but the filter does't works after my changes.

gridOptions = {
    enableFilter: true,
    ...
    columnDefs: [
        {headerName: "Status", field: "status", filter: "agTextColumnFilter", 
        filterParams: { defaultOption: { notContains: 'default text'} }  }
    ]
}

I am using this documentation.

1 Answer

Just do this when you are pushing data in ag-grid

columnData.push({
              headerName: "Site Name", 
              field: "siteName",
              dataType: "string",
              enableValue: true,
              filter: "agTextColumnFilter",
              editable: false,
            });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.