角度ui-grid事件:选择列

时间:2022-06-25 19:42:23

I am trying to get selected column value based on the selection of a column on ui grid. 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.

我试图根据ui网格上的列选择获得选定的列值。从那个值我用来过滤另一个uigrid表,以便如何在select列和所选列值上调用一个函数。

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);
                });

            };

1 个解决方案

#1


0  

I have created a plunker for your problem. Please check:

我为你的问题创造了一个plunker。请检查:

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();
};

#1


0  

I have created a plunker for your problem. Please check:

我为你的问题创造了一个plunker。请检查:

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();
};