按钮单击在 Celltemplate 角度网格中不起作用 [英] Button click does not work in Celltemplate angular grid

查看:21
本文介绍了按钮单击在 Celltemplate 角度网格中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 celltemplate.但是点击事件不起作用.

I m trying to work with celltemplate. But click event did not work.

    $scope.format = function(val){
            return val.replace(/\//g, "");
        };

        var executionColumns = {
            data: [],
            enableSorting: true,
            paginationPageSizes: [25, 50, 75],
            paginationPageSize: 25,
            enableColumnMenu: true,
            enableFiltering: true,
            columnDefs: [

              { field: 'StartDate', cellTemplate: '<button ng-click="format (row.entity)">log</button>' },
              { field: 'Status' },

            ]

        };

那我该怎么办?有什么问题?

So what should I do? What is the wrong?

推荐答案

它对我来说就像第二个代码

It works for me like the 2nd code

         columnDefs: [
          { field: 'StartDate', cellTemplate: '<button ng-click="format(grid.getCellVale(row.entity)   )">log</button>' },
          { field: 'Status' },

        ]

或将您的格式函数移动到定义为

or move your format function to an externalscope defined as

 $scope.globalExternalScope = {
       format:function(entity){..........}
    }

然后使用模板

         columnDefs: [
          { field: 'StartDate', cellTemplate: '<button ng-click="getExternalScopes().format(grid.getCellVale(row.entity)   )">log</button>' },
          { field: 'Status' },

        ]

这篇关于按钮单击在 Celltemplate 角度网格中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆