简体   繁体   中英

How to use ag-grid checkbox with angular

在此处输入图片说明

How to bind the checkbox value with event.and how to access the curresponding data?

home.ts

 columns = [
 {
  field: 'reportingLocation',
  headerName: 'Reporting Location '
 },
 {
  field: 'country',
  headerName: 'Country Name'
 },
 {
  field: 'DEL',
  headerName: 'DEL',
  editable:true,
  headerCheckboxSelection: true,
  headerCheckboxSelectionFilteredOnly: true,
  checkboxSelection: true
 } ];

And i have one function to get the rows with DEL=TRUE

 deleteLocations(e) {
console.log(this.list);
e.preventDefault();
this.list
.filter((item: any) => {
  return !!item.DEL;
})
.map(item => {
  this.store.dispatch(new

 LocationAndResponsibilityActions.OnLocationDelete(item.location_Id));
  });  }

I could not access the DEL Value,What is the proper way to use aggrid checkbox selection?

ag-grid has a number of selection events , but it sounds like (rowSelected) may be what you are looking for. It passes an object back as a param which contains the row data as well as some other useful properties.

Plunker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM