Joey Driessen
Joey Driessen

Reputation: 318

Check which column has been clicked on rowClick event

I am looking for a way to see which column the rowClick event has happened. Because based on which column this happend we want other things to happen. We already got something like this:

this.chart.listen('rowClick', (event) => {
  if (event['period'] && event['period'].itemType === GanttItemType.work) {

    setTimeout(() => this.clickedDetail(event), 1);
  } else if (event['item'] && event['item'].get('technicianId') && !event['period']) {
   // HERE WE WANT TO KNOW IN WHICH COLUMN WE ARE
    const technicianId = event['item'].get('technicianId');
    setTimeout(() => this.openTechnician(technicianId), 1);
  } else {
   this.preventDef(event);
  }
});

Thanks in advance I cannot seem to find if/where this is possible

Upvotes: 0

Views: 106

Answers (1)

AnyChart Support
AnyChart Support

Reputation: 3905

Unfortunately, there's no out-of-the-box method to implement such functionality, so it requires some tricks. The idea is quite simple – if dataGrid columns width is predefined we can compare the click X-coordinate and the column width. For details, check the sample by the link provided in the comment below.

Upvotes: 1

Related Questions