简体   繁体   English

ui-grid角度事件:已选择列

[英]angular ui-grid event: column selected

I am trying to get selected column value based on the selection of a column on ui grid. 我试图基于ui网格上的列的选择来获取选定的列值。 From that value i used to filter another uigrid table so how to call a function on select of column and the selected column value. 从那个值中,我用来过滤另一个uigrid表,因此如何在选择列和选定列值时调用函数。

This is my sample code which i am using presently: 这是我目前正在使用的示例代码:

$scope.gridOptions[0].onRegisterApi = function(gridApi){
                $scope.gridApi.push(gridApi);
                gridApi.cellNav.on.navigate($scope,function(newRowCol, oldRowCol){

                    var name = newRowCol.col.name;

                    var  filterWithData = newRowCol.row.entity[name];
                    //$scope.filtert(name,filterWithData);
                });

            };

I have created a plunker for your problem. 我为您的问题制造了一个小插曲。 Please check: 请检查:

Plunker 柱塞

 $scope.refreshData = function (termObj) {
   $scope.gridOptions2.data = $scope.data;
    if (termObj.length > 2) {

        while (termObj) {
            var oSearchArray = termObj.split(' ');
            $scope.gridOptions2.data = $filter('filter')($scope.gridOptions2.data, oSearchArray[0], undefined);
            console.log($scope.gridOptions2.data)
            oSearchArray.shift();
            termObj = (oSearchArray.length !== 0) ? oSearchArray.join(' ') : '';
        }
    }
    else {
        $scope.gridOptions2.data = $scope.gridData;
        $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.OPTIONS);
    }
    $scope.$apply();
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM