zoukankan      html  css  js  c++  java
  • angular ui-grid selectRow 设置选中

    设置选中:$scope.gridApi.selection.selectRow(rowEntity);

    取消选中:$scope.gridApi.selection.unSelectRow(rowEntity);

    获取选中行: $scope.gridApi.selection.getSelectedRows();

    选中所有行:$scope.gridApi.selection.selectAllRows();

    取消选中的所有行:$scope.gridApi.selection.clearSelectedRows();

    头文件里需要加上$timeout

    (function () {
    angular.module('app').controller('app.hrm.views.salary.salaryDifferentMonthPaymentStatement.selectApplyEmployees', [
    '$scope', '$uibModalInstance', '$timeout', 'abp.services.app.salary',
    function ($scope, $uibModalInstance,$timeout, salaryService) {

    }

    加载的方法:

    function init(url) {
    salaryService.getAll({ id: id}).then(function (result) {
    vm.gridOptions.totalItems = result.data.totalCount;
    vm.gridOptions.data = result.data.items;

    angular.forEach(vm.gridOptions.data, function (v, k) {
    if (v.isChecked) {
    $timeout(function () {
    $scope.gridApi.selection.selectRow(v);
    }, 1000);
    }
    else {
    $timeout(function () {
    $scope.gridApi.selection.unSelectRow(v);
    }, 1000);
    }
    });

    }).finally(function () {
    vm.loading = false;
    });

    }

  • 相关阅读:
    [开发笔记usbTOcan]PyUSB访问设备
    spring之web.xml
    SpringMVC中Controller如何将数据返回
    总结
    流的append
    对象,构造方法、类
    多态
    类的多态性
    环境变量
    构造方法和成员方法的区别
  • 原文地址:https://www.cnblogs.com/luoxiaoxiao102/p/15022746.html
Copyright © 2011-2022 走看看