[英]Get Selected value from ui-grid using jquery/javascript
In My project,we used data grid using AngularJS Implementation as follows. 在我的项目中,我们通过AngularJS实现使用了数据网格,如下所示。
<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 . 我可以使用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. 但由于某些要求,我也想使用jquery / javascript获取网格中的选定项。.我尝试使用jquery来获取价值,如下所示。 but it didn't work.
但这没用。
var entity = $('#entityGrid option:selected');
please help here. 请在这里帮助。
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 这是一个: 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. 您在
$scope.retainSelection
获得的是一个key:value对对象。 You can access which ever key of it. 您可以访问其中的任何键。
Here is another question talking about this: 这是另一个谈论这个的问题:
Where can I get Angular ui-grid selected items 我在哪里可以获得Angular ui-grid选定的项目
Hope it helps. 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.