如何使用angularjs在ui网格的单元格中获取选中的复选框值

如何使用angularjs在ui网格的单元格中获取选中的复选框值,angularjs,gridview,angular-ui-grid,checkboxlist,Angularjs,Gridview,Angular Ui Grid,Checkboxlist,我有UI-gridbuild-inangularjs,我在其中使用了单元格模板复选框。当我单击特定复选框时,我想获得该复选框值,这意味着我有类似表格的结构,在表格单元格中我有复选框。现在我想获得选中的复选框值 这是我的密码 $scope.gridOptionsNew = { appScopeProvider : $scope, columnDefs : [{ enableCellEdit : false, field : 'SponsorType',

我有
UI-grid
build-in
angularjs
,我在其中使用了单元格模板复选框。当我单击特定复选框时,我想获得该复选框值,这意味着我有类似表格的结构,在表格单元格中我有复选框。现在我想获得选中的复选框值

这是我的密码

$scope.gridOptionsNew = {
appScopeProvider : $scope,
columnDefs : [{
        enableCellEdit : false,
        field : 'SponsorType',
        displayName : me.labelText.ADD_STORY_TABLE_SPONSOR_TYPE

    }, {
        //enableCellEdit: true,
        field : 'Hoarding',
        displayName : me.labelText.ADD_STORY_TABLE_HOARDING,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    },
    {
        //enableCellEdit: true,
        field : 'Print',
        displayName : me.labelText.ADD_STORY_TABLE_PRINT,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }, {
        //enableCellEdit: true,
        field : 'Radio',
        displayName : me.labelText.ADD_STORY_TABLE_RADIO,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }, {
        //enableCellEdit: true,
        field : 'StageBackDrops',
        displayName : me.labelText.ADD_STORY_TABLE_STAGE_BACK_DROP,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }, {
        //enableCellEdit: true,
        field : 'Stalls',
        displayName : me.labelText.ADD_STORY_TABLE_STALLS,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }, {
        //enableCellEdit: true,
        field : 'Banners',
        displayName : me.labelText.ADD_STORY_TABLE_BANNERS,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }, {
        //enableCellEdit: true,
        field : 'Seats',
        displayName : me.labelText.ADD_STORY_SEATS,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }, {
        //enableCellEdit: true,
        field : 'VenueBanners',
        displayName : me.labelText.ADD_STORY_VENUE_BRANDING,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }, {
        //enableCellEdit: true,
        field : 'StagePresence',
        displayName : me.labelText.ADD_STORY_STAGE_PRESENCE,
        cellTemplate : '<div class="text-center"><input type="checkbox" ' +
        'name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
    }
]}

$scope.yourMethod = function (radio) {
  console.log("value", radio);
};
$scope.gridoptions新建={
appScopeProvider:$scope,
columnDefs:[{
enableCellEdit:false,
字段:“赞助商类型”,
显示名称:me.labelText.ADD\u STORY\u TABLE\u赞助商\u TYPE
}, {
//enableCellEdit:true,
字段:“囤积”,
显示名称:me.labelText.ADD\u STORY\u TABLE\u囤积,
单元格模板:“”
},
{
//enableCellEdit:true,
字段:“打印”,
显示名称:me.labelText.ADD\u STORY\u TABLE\u PRINT,
单元格模板:“”
}, {
//enableCellEdit:true,
字段:“收音机”,
显示名称:me.labelText.ADD\u STORY\u TABLE\u RADIO,
单元格模板:“”
}, {
//enableCellEdit:true,
字段:“StageBackDrops”,
显示名称:me.labelText.ADD\u STORY\u TABLE\u STAGE\u BACK\u DROP,
单元格模板:“”
}, {
//enableCellEdit:true,
字段:'Stalls',
显示名称:me.labelText.ADD_STORY_TABLE_STALLS,
单元格模板:“”
}, {
//enableCellEdit:true,
字段:'横幅',
显示名称:me.labelText.ADD_STORY_TABLE_横幅,
单元格模板:“”
}, {
//enableCellEdit:true,
字段:'座位',
显示名称:me.labelText.ADD_STORY_SEATS,
单元格模板:“”
}, {
//enableCellEdit:true,
字段:'Venuebaners',
显示名称:me.labelText.ADD\u STORY\u vention\u BRANDING,
单元格模板:“”
}, {
//enableCellEdit:true,
字段:'StagePresence',
显示名称:me.labelText.ADD\u STORY\u STAGE\u PRESENCE,
单元格模板:“”
}
]}
$scope.yourMethod=函数(收音机){
控制台日志(“值”,无线电);
};

请按如下所示进行尝试

设置网格选项,如:

 $scope.gridOptionsNew = { 
         appScopeProvider: $scope,
         //your other options
cellTemplate: '<div class="text-center"><input type="checkbox" '+
name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
     //your Method
      $scope.yourMethod = function (radio) {

        //your logic
      };
cellTemplate: '<div class="text-center"><input type="checkbox" '+
name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity)"/></div>'
然后模板:

 $scope.gridOptionsNew = { 
         appScopeProvider: $scope,
         //your other options
cellTemplate: '<div class="text-center"><input type="checkbox" '+
name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
     //your Method
      $scope.yourMethod = function (radio) {

        //your logic
      };
cellTemplate: '<div class="text-center"><input type="checkbox" '+
name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity)"/></div>'
更新:

 $scope.gridOptionsNew = { 
         appScopeProvider: $scope,
         //your other options
cellTemplate: '<div class="text-center"><input type="checkbox" '+
name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity.Radio)"/></div>'
     //your Method
      $scope.yourMethod = function (radio) {

        //your logic
      };
cellTemplate: '<div class="text-center"><input type="checkbox" '+
name="radio" value="radio" ng-click="grid.appScope.yourMethod(row.entity)"/></div>'

cellTemplate:“您好,非常感谢您的回答。我刚刚在函数中对radio的值进行了控制台操作,但显示为未定义。我这样做了$scope.yourMethod=function(radio){console.log(“hello”,radio);};它在hello前面显示“”您可以将最新的代码片段放在上面的帖子上吗?请参阅
更新
部分。这样做可以使用debug查看值。只需使用
F10
进行调试即可。