ag-grid column search not working with object as cell value

ag-grid, angularjs

Solution

By default the textFormatter from Ag-grid is returning a string representation, if you include textFormatter and return the same object in the textCustomComparator you'll have the object from the valueGetter:

   filter: "agTextColumnFilter",
filterParams: {
    textCustomComparator: function  (filter, value, filterText) {
        //value is the object from valueGetter
    },
    textFormatter: function(r) { 
        //this is the solution
        return r; 
    }, 
    valueGetter: function getter(params) {
        return {
            ...
        };
    }
}

Problem

I am using cell_renderer to define my cell, something like this: ``` var cell_renderer = function(params) { var element = ""; var values = params.value; angular.forEach(values, function(each_param){ element += '<a href="#/workunit/' + each_param.id + '" target="_blank">' + each_param.id + '<span class="text-danger text-bold">'+ '<span class="" title="' + inactive_message + '">' + inactive_flag + ' </span>' + '<span class="" title="' + misconfigured_message + '"> ' +misconfigured_flag + '</span>'+ '</span></a><br>'; }) return element; }; ``` My column definnition is this: ``` var testObject = {}; testObject.headerName = "my header"; testObject.field = each_branch; testObject.width = 200; testObject.cellClassRules = cell_class_rules; testObject.cellRenderer = cell_renderer; columnDefs.push(testObject); ``` Here testObject.field = each_branch , is a json object. Hence the inbuild search functionality not working in ag-grid. Can anyone please help me here.

Original source