如何禁用或取消选中ng-grid中的复选框?

时间:2015-06-03 01:56:33

标签: javascript angularjs checkbox ng-grid

我需要根据条件禁用或取消选中复选框。我尝试使用此解决方案how to disallow selection with beforeSelectionChange for select All chekbox selection in ng-grid,但选择了行(数据)。

$scope.gridQueryReporte = {

data: 'dataPaginadaIntegrantes',
columnDefs: [{
    field: 'numeroSolicitud',
    displayName: 'label_id_solicitud',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'tipoNumIdSolicitud',
    displayName: 'Tipo y No. Id Solicitud',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'nombreSolicitud',
    displayName: 'Nombre Solicitud',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'tipoNumIdIntegrante',
    displayName: 'Tipo y No. Id Integrante',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'nombreIntegrante',
    displayName: 'label_nombre_integrante',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'fechaPublicacion',
    displayName: 'label_fecha_publicacion_solicitud',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'estado',
    displayName: 'label_estado',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'anotacion',
    displayName: 'label_con_anotacion',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid()
}, {
    field: 'idIntegrante',
    displayName: 'label_titulo_detalle_solicitud',
    headerCellTemplate: loadHeaderGrid(),
    cellTemplate: loadCellGrid({
        type: 'img',
        image: 'verDetalleGrid',
        toValidate: 'idIntegrante',
        funcion: 'abrirModalDetalle(row.entity)'
    })
}],
primaryKey: "idIntegrante",
enableRowSelection: true,
showSelectionCheckbox: true,
multiSelect: true,
selectWithCheckboxOnly: true,
selectedItems: $scope.integranteSeleccionado,
showColumnMenu: true,
enablePaging: true,
showFooter: true,
pagingOptions: $scope.pagingOptionsIntegrantes,
filterOptions: $scope.filterOptions,
showFilter: true,

afterSelectionChange: function (rowItem) {
    $scope.contadorBanderaBoton = $scope.gridQueryReporte.selectedItems.length;

    $scope.selectedIDs = [];
    var objetoIntegrante = {};

    angular.forEach($scope.integranteSeleccionado, function (item) {
        //here i want uncheck or disable the checkbox                     
        if (item.rutaReporteRiesgos == null || item.rutaReporteRiesgos == "") {
            if (rowItem.selected) {
                $scope.gridQueryReporte.selectRow(rowItem.rowIndex, false);
            }
        }
    });
}

};

0 个答案:

没有答案