hjalmers / angular-generic-table

A generic table for Angular 2+. Generic table uses standard markup for tables ie. table, tr and td elements etc. and has support for expanding rows, global search, filters, sorting, pagination, export to CSV, column clicks, custom column rendering, custom export values.
https://hjalmers.github.io/angular-generic-table/
MIT License
105 stars 55 forks source link

click on elements that is inside of cell #275

Closed vaydich closed 5 years ago

vaydich commented 5 years ago

Hello

I have 5 images that render in loop inside each cell. How can i listen click of each image but not hole cell?

hjalmers commented 5 years ago

Take a look at the custom-column example and handle the click event inside your component instead.

The field settings for the column should look something like this:

{
objectKey: 'images',
name: 'Images',
columnComponent: {
    type: ImagesComponent
  }
}

The images component should in turn look something like this:

export class ImagesComponent extends GtCustomComponent<Row> implements OnInit {

    constructor() {
        super();
    }

    ngOnInit() {
        console.log(this.row); // log the row
        console.log(this.column); // log the column
    }
}
vaydich commented 5 years ago

I got it. Thx!