angular-ui-gridui-grid

What are the available condition constants under uiGridConstants.filter?


Did I miss the link that documents ALL the available uiGridConstants for uiGrid fields in one place? I was working on columnDefs filter and found out EQUAL does not work. That's when I realized there is no central documentation for all the condition constants for uiGridConstants.

columnDefs:
 [ {   }
    , { field: '_pointXID', filter
        : {
            condition: uiGridConstants.filter.CONTAINS, placeholder: '%PATTERN%'
        }, headerCellClass: $scope.whatfilter}
    , { field: '_statU16', width: "5%", filter
        : {
            condition: uiGridConstants.filter.EQUAL, placeholder: '=='
        }, headerCellClass: $scope.whatfilter}
    , { field: '_valDoub', width: "5%", enableFiltering: false }

 ]

EQUAL's not one of them, and heck how do I know?!


Solution

  • Looks like I have to open up the source ui-Grid.js to find “uiGridConstants.filter.” literals in the code. Here it is, my summary for all the ui-grid’s available filter conditions in these constants 

    1.  STARTS_WITH
    2.  ENDS_WITH
    3.  CONTAINS 
    4.  EXACT
    5.  NOT_EQUAL
    6.  GREATER_THAN
    7.  GREATER_THAN_OR_EQUAL
    8.  LESS_THAN
    9.  LESS_THAN_OR_EQUAL
    

    Have I got all of them or still missed something? (Notice that I can’t locate EQUAL in the source, instead, EXACT!)

    You guys are asking of whether there is a default condition. I don't believe there's one, but if your input filter.condition value is not any of the above, your Column filter will return a TRUE which means you have no filters!

    So in other words, the default is NO FILTERS : anything goes if your condition constant is not valid