-1

我无法在 angularjs 中的 angular-grid 中制作复选框,并且我使用了 celltemplate,但它没有与我的控制器绑定我在我的控制器中尝试过:

"cellTemplate":'<input type="checkbox"  ng-model="row.isSelected" ng-click=" $scope.gridOptions.selectRow($event,row)">

我正在使用角度网格

4

2 回答 2

0

在 div 中写入输入字段

cellTemplate: '<div><input  type="checkbox" ng-click="grid.appScope.selectRow($event,row)"/></div>'
于 2016-06-17T16:44:43.643 回答
0

这就是我们如何在 ui-grid 中放置一个复选框:

需要在列中使用模板。我已经包含了一个 ng-click,它需要额外的处理

 $scope.gridOptions = {
      data: $scope.yourData,
      columnDefs: [
            {
                field: "selected",
  cellTemplate: "
  <div class=\"ui-grid-cell-contents\">
     <span ng-cell-text>
        <input type=\"checkbox\" ng-model=\"row.entity.selected\" 
          ng-disabled=\"row.entity.checkBoxDisabled\" 
          ng-click=\"$event.stopPropagation();grid.appScope.hasChanged()\">
       </span>
   </div>
  "
}

ui-grid 应用范围

于 2016-06-17T16:21:39.390 回答