0

Is there a way to manually trigger the Grid-Event onRowClicked programmatically? If I set a node to selected via

node.setSelected(true);

, the event isn't being triggered... Only if I really click on it, but I need to trigger it programmatically too, as a reaction to a service-call.

Vortilion
  • 406
  • 2
  • 6
  • 24
  • do you have knowledge of rowid or row-index value with you? – sandeep joshi Sep 16 '20 at 16:05
  • @sandeepjoshi No, but another attribute. I'm already identifiying the correct row and setting it to selected as written above. But this does not trigger the onRowClicked-Event. – Vortilion Sep 17 '20 at 05:31

1 Answers1

2

Seems pretty simple to me. Just call the onRowClicked function on your gridOptions. Seeing as you already have your node, you should be able to get the row and pass it to your onRowClicked function.

var gridOptions = { 
  columnDefs: columnDefs,
  rowData: rowData,
  onRowClicked: function(params)
  {
    console.log('Row Make: ' + params.data.make);
  }
};

function clickRowOne()
{
  const node = gridOptions.api.getRowNode(0);
  gridOptions.onRowClicked(node);
}

Demo.

ViqMontana
  • 5,090
  • 3
  • 19
  • 54