How can I disable check box that is part of Clarity datagrid?
Asked Answered
C

2

7

I use Clarity datagrid and I need to disable the checkbox selection under some conditions. I can't find API to do so. Please help and thanks.

Chrysalid answered 14/9, 2017 at 17:55 Comment(0)
G
4

Disabling selection for specific rows of a datagrid is not available in Clarity yet, but there is a Contributions welcome issue open for it: https://github.com/vmware/clarity/issues/1018

Gurglet answered 14/9, 2017 at 21:30 Comment(0)
E
3

I had similar requirement and ended up implementing the behavior using a custom directive. have a look at: https://plnkr.co/edit/5fQkvG?p=preview

@Directive({
  selector: '[clrDisable]'
})
export class DisableDirective implements OnInit, OnChanges {

  @Input('clrDisable') disabled:boolean

  constructor(private elementRef:ElementRef) {

  }

  ngOnInit(){

  }

  ngOnChanges() {
    let nativeRef = this.elementRef.nativeElement;
    if(this.disabled) {
      nativeRef.classList.add("clr_disabled");
    } else {
      nativeRef.classList.remove("clr_disabled");
    }
  }


}


.clr_disabled{
  pointer-events:none;
  background-color:#ccc;
  opacity:0.5;  
}
Evanevander answered 11/3, 2018 at 10:1 Comment(1)
But after clicking select all checkbox in header, that disabled rows also get selected. Any solution for that?Tedesco

© 2022 - 2024 — McMap. All rights reserved.