ng-table:如何在不同页面上使用multiselect

时间:2016-02-25 13:45:13

标签: javascript html angularjs ngtable

我正在使用此页面中的ng-table示例:

http://4dev.tech/2015/08/tutorial-basic-datatable-sorting-filtering-and-pagination-with-angularjs-and-ng-table/

我还添加了ng-click方法的选择方法

<table ng-table="usersTable" id="productTable" class="table table-striped">

                            <tr>
                                <th ng-repeat="column in cols">{{column}}</th>
                                <th> Adet</th>
                            </tr>

                            <tr ng-repeat="row in data  | filter: src_product">
                                @*<td ng-class="{ 'highlighted':row[column].isSelected }" ng-click ="selectCell(row[column])" ng-repeat="column in cols "> {{row[column]}} </td>*@

                                <td ng-class="{'highlighted':isSelected =='true'}" ng-model="product_field" ng-click="selectCell(this)" ng-repeat="column in cols ">{{row[column]}}</td>
                                <td><input class="input-group" type="text" style="width: 100%; height: 30px !important" name=" adet" value="0"></td>
                            </tr>

                        </table>





$scope.selectCell = function(cell) {

    var selectedCellindex = (cell.$index) + (cell.$parent.$index) * ($scope.cols.length + 1);
    var selectedCell = document.getElementsByTagName("td")[selectedCellindex];

    if (selectedCell.getAttribute("class") === null) {

        selectedCell.setAttribute("class", "highlighted");

    } else {
        selectedCell.removeAttribute("class");
    }

}

问题是它只选择当前可见页面上的单元格。如何解决此问题或存储选定的单元格?

0 个答案:

没有答案