使用ng-filter。仅过滤两列

时间:2014-02-10 17:07:10

标签: angularjs ng-grid

$scope.filterOptions = {
            filterText: "",
            useExternalFilter: false
        };

    $scope.gridOptions = { 
        data: 'myData' ,
        filterOptions: $scope.filterOptions,
         showFilter: false,

        },
        columnDefs: [

                {field:'firstName', displayName:'First'}, 
                {field:'lastName', displayName:'Last'},
                 {field:'department', displayName:'Department'},
                 {field:'location', displayName:'Location'},
                 {
                    field:'xmppStatus', 
                    displayName:'Status', 
                    cellTemplate: 'cellTemplate_status.html'
                 },
                ]
    };

这是我的代码。我想只过滤名字和姓氏。表数据来自json文件。

1 个答案:

答案 0 :(得分:0)

查看“ColumnDefs选项”下的http://angular-ui.github.io/ng-grid/,在“sortable”属性下。如果您不对要排序的列进行排序,则将其设置为false;如果您执行

,则设置为true