Skip to content Skip to sidebar Skip to footer

Custom "cellfilter" In Angular Js

I am working with the ng-grid in Angular js. I have this line of code which defines the type of filter added. columnDefs: [{field:'date', displayName:'Birth Date', cellFilter:'da

Solution 1:

Use a custom sort function:

var result = 1;
    var test="HML";
    function impSortFn(a, b) {
    a=test.indexOf(a);
    b=test.indexOf(b);
    if (a == b) return0;
    if (a < b) return -1;
    return result;
    }

    $scope.gridOptions = {
    data: 'myData',

    columnDefs: [{
      field: 'name',
      displayName: 'Name'
    }, {
      field: 'age',
      displayName: 'Age'
    }, {
      field: 'imp',
      displayName: 'Important',
      sortFn: impSortFn
    }]

See this Plunker

Post a Comment for "Custom "cellfilter" In Angular Js"