角度ui-grid事件:选择列

时间:2015-12-16 09:12:21

标签: javascript jquery angularjs angular-ui-grid

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

这是我目前使用的示例代码:

$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 个答案:

答案 0 :(得分:0)

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

Plunker

    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleAlert];
UIViewController *v = [[UIViewController alloc] init];
v.view.backgroundColor = [UIColor cyanColor];

[alertController setValue:v forKey:@"contentViewController"];

UIAlertAction *selectImage = [UIAlertAction
                                actionWithTitle:@"First Button"
                                style:UIAlertActionStyleDefault
                                handler:^(UIAlertAction *action){

                                    NSLog(@"First Button");

                                }];

[alertController addAction:selectImage];

UIAlertAction *addImage = [UIAlertAction
                                 actionWithTitle:@"Second Button"
                                 style:UIAlertActionStyleDefault
                                 handler:^(UIAlertAction *action) {

                                     NSLog(@"Second Button");

                                 }];
[alertController addAction:addImage];

alertController.view.tintColor = [UIColor redColor];

UIView *subView = alertController.view.subviews.firstObject;
UIView *alertContentView = subView.subviews.firstObject;
[alertContentView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]]];

alertContentView.layer.cornerRadius = 5;

[self presentViewController:alertController animated:YES completion:nil];