In drupal 8, I am writing a custom module and in one of the function in controller -I am fetching data from an external API, then displaying it in table format using -
foreach($rec as $data) {
ksm($data);
$rows[] = [// mydata
]};
return [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
];
This is working correctly.
But I want table cells to be editable and when user edits the data, a listener gets invoked (or provide an update button for the user). Now this listener would do some stuff with updated data(make external API call). My doubt is how can we do this with tables? Is there any way to make some columns of table editable and register a listener in Drupal.
Would I need to create a node for each row of this table data? If a node is required, then how to do ?
I am new to Drupal 8, just started a month ago, kindly help. Thanks in advance.