0

I am trying get row object selected with row click event. I am using Angular UI Grid

Here is the API link http://ui-grid.info/docs/#/tutorial/103_filtering

I used this to get the data:

    enableRowSelection: true,
        multiSelect:false,
        onRegisterApi : function(gridApi){
  //set gridApi on scope
  $scope.gridApi = gridApi;
  gridApi.selection.on.rowSelectionChanged($scope,function(row){
    var msg = 'row selected ' + row.isSelected;
    $log.log(msg);
  });

Here is my code https://plnkr.co/edit/DqBgHFnwLpYM5pvg0f56?p=preview

1 Answer 1

1

Inject ui.grid.selection into your app module:

angular.module('app',['ngTouch', 'ui.grid', 'ui.grid.selection'])

Setup selection on html:

<div id="grid1" ui-grid="gridOptions" ui-grid-selection class="grid" ></div>

Get selected row object using row.entity:

 gridApi.selection.on.rowSelectionChanged($scope,function(row){
    var msg = 'row selected ' + row.entity.age;
    console.log(msg);
  });

Working plunker:

https://plnkr.co/edit/fxtD3F4iFxmPKT1G1t7V

Sign up to request clarification or add additional context in comments.

4 Comments

is there any another way to do same thing ?? because it is showing check box ..I don't need check box .I just want to click any where on row
@user944513: you can add enableRowHeaderSelection: false to turn off the checkbox
could you please look on this Question stackoverflow.com/questions/34612856/…
@user944513: sorry I don't have experience on inline editing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.