1
votes

In master/detail example, the expand/collapse icon is always present when setting [masterDetail]=true. However, my data sometimes does not have detail rows and I would like to hide the chevron in this situation. In my example, callRecords property would be present on the data but it would be null:

getDetailRowData: function(params) {
    params.successCallback(params.data.callRecords);
},

How can I not show the chevron on master grid when the data is null? Note: the example visible here: https://www.ag-grid.com/javascript-grid-master-detail-detail-grids/#detail-grid-options

1

1 Answers

2
votes

This exact requirement is covered here in docs.

Basically you implement isRowMaster -

this.isRowMaster = function(dataItem) {
  return dataItem ? dataItem.callRecords.length > 0 : false;
};

From docs -

In specify which rows should expand, provide the grid callback isRowMaster. The callback will be called once for each row. Return true to allow expanding and false to disallow expanding for that row.