0

In My project,we used data grid using AngularJS Implementation as follows.

<div  id="entityGrid" ui-grid="selectedOptions" ui-grid-selection data-ng-model="selectedOptions"></div>

i can get selected item in grid as below using angular.js .

"entity" :  $scope.createString($scope.selectedOptions.data)

but i also want to get selected item in grid using jquery/javascript due to some requirement.. i tried to get value using jquery as below. but it didn't work.

var entity = $('#entityGrid option:selected'); 

please help here.

sa9689
  • 65
  • 1
  • 2
  • 7

1 Answers1

0

You question is not very clear. I wonder if you could provide a plunker of your codes.

Here is one: http://plnkr.co/edit/3KXrUuCsSACuhefmyzxN?p=preview

When you click "Copy" button, the following function is invoked:

$scope.copySelection = function (){
    $scope.retainSelection = $scope.gridApi.selection.getSelectedRows();    
}; 

What you get in $scope.retainSelection is an object of key:value pairs. You can access which ever key of it.

Here is another question talking about this:

Where can I get Angular ui-grid selected items

Hope it helps.

Community
  • 1
  • 1
gm2008
  • 4,245
  • 1
  • 36
  • 38
  • I can't provide plunker of my code due to policies. regarding another question link – sa9689 Dec 26 '15 at 05:33
  • ,I can't provide plunker of my code due to policies. regarding another question link, I am able to get selectedRows in angular js function. but function in that controller scope of angular js. but i want create function to be called from another js file outside scope controller. so one way to do it create javascript/jquery function which is called from anywhere in my project. so i tried to get selected rows using jquery as mention in my question . but it didn't work. do you any other soln to get selected rows using jqery/js. – sa9689 Dec 26 '15 at 05:43