2016-05-30 34 views
0

我是新來的角js。我想選中複選框,當我點擊行來編輯特定的cell.I已採取celltemplate顯示在ui網格中的複選框。但現在當我點擊該行獲取選中的行,但複選框在該行未被選中。使用angularjs在行中點擊複選框使用ui-grid

這是我的併網

$scope.myDataSocailMediaMarketing =[]; 
$scope.gridOptionsSocialMediaMarketing = { 
      appScopeProvider: $scope, 
      data : 'myDataSocailMediaMarketing' , 
//   enableCellSelection: true, 
//   enableRowSelection: false, 
      enableRowHeaderSelection :false, 
      enableRowSelection: true, 
      enableCellEdit: true, 
      enableHorizontalScrollbar: 0, 
      enableRowSelection: true, 
      enableSelectAll: true, 
      enableFullRowSelection : true, 
      rowEditWaitInterval: -1, 
      columnDefs: [ 
       { 
        cellClass : 'grid-align', 
        width : '10%', 
        minWidth : '10%', 
        enableCellEdit: false, 
        field: 'select', 
        displayName: me.labelText.ADD_STORY_TABLE_SELECT, 
        cellTemplate: '<div class="ngCellText text-center">'+ 
            '<input type="checkbox" '+ 
            'ng-model="row.entity.select" '+ 
            'ng-click="grid.appScope.checkboxRowClick(row.entity)""/>'+ 
            '</div>' 

       }, 
       { 
         cellClass : 'grid-align', 
         width : '30%', 
         minWidth : '30%', 
         enableCellEdit: false, 
         field: 'category', 
         displayName: me.labelText.ADD_STORY_TABLE_CATEGORY 

       }, 
       { 
         cellClass : 'grid-align', 
         width : '60%', 
         minWidth : '60%', 
         enableCellEdit: true, 
         field: 'descriptionOrExample', 
         displayName: me.labelText.ADD_STORY_TABLE_DESCRIPTION          
       } 
      ],          
    }; 

在HTML我已經宣佈它原樣

<div> 
<div class="gridHeightSocialMarketing socialMediaMarketing table" ui-grid-edit ui-grid-row-edit ui-grid-selection ui-grid="gridOptionsSocialMediaMarketing" style="height:242px;"> 
</div> 
</div> 

回答

0

由於對複選框選擇在你的代碼沒有代碼。您必須手動選中您的複選框,方法是使用rowSelectionChanged事件。

看看這個tutorial如何使用rowSelectionChanged來選擇或取消選中複選框。

這裏是另一個職位rowSelectionChanged功能angular ui-grid event: row selected

+0

謝謝你的偉大help.I將通過教程。 –

相關問題