相关疑难解决方法(0)

从ng-grid获取选择的行?

如何在ng-grid中创建(或访问)所选行的数组?


文档(滚动到"网格选项")

id                 | default value | definition
-----------------------------------------------
selectedItems      |       []      | all of the items selected in the grid.
                                     In single select mode there will only
                                     be one item in the array.
Run Code Online (Sandbox Code Playgroud)

的index.html

<body ng-controller="MyCtrl">
    <div class="gridStyle" ng-grid="gridOptions"></div>

    <h3>Rows selected</h3>
    <pre>{{selectedItems}}</pre>
</body>
Run Code Online (Sandbox Code Playgroud)

main.js

var app = angular.module('myApp', ['ngGrid']);
app.controller('MyCtrl', function($scope) {
    $scope.myData = [{name: "Moroni", age: 50},
                     {name: "Tiancum", age: 43},
                     {name: "Jacob", age: 27},
                     {name: "Nephi", age: 29},
                     {name: "Enos", age: 34}];
    $scope.gridOptions = …
Run Code Online (Sandbox Code Playgroud)

data-binding angularjs angularjs-directive angularjs-scope ng-grid

12
推荐指数
2
解决办法
4万
查看次数