dimanche 29 mai 2016

select checkbox on row click in ui-grid using angularjs

I am new to angular js. and i want to select the check box when i click on the row to edit that particular cell.I have taken celltemplate to show the checkbox in the ui-grid.but now when i click on the row the row gets selected but the checkbox in that row is not getting selected.

This is my 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

                                                             }

                                                             ],


                                        };  

in html i have declared it as-

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




Aucun commentaire:

Enregistrer un commentaire