简体   繁体   English

如何使用Angular的AG网格复选框

[英]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 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 我有一个函数来获取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? 我无法访问DEL值,使用聚集复选框选择的正确方法是什么?

ag-grid has a number of selection events , but it sounds like (rowSelected) may be what you are looking for. ag-grid有很多选择事件 ,但是听起来(rowSelected)可能正是您想要的。 It passes an object back as a param which contains the row data as well as some other useful properties. 它将对象作为参数传递回去,该参数包含行数据以及其他一些有用的属性。

Plunker Plunker

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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