Event in datatable

hello, sorry for the dumb question!! i am a genuine beginner… someone will be able to answer this is in 30 seconds.

I have a data table populated by CSV. I want the user to be able to select a row, and I need the script to extract one of the fields within that row (data0), which i will then use as a variable to populate a pivot chart filter.

at the moment i am working on this and i think (hope…) i am close -

on:{
onSelectChange:function(id){
selected = $$("myTeam").getSelectedId(id);
alert("team:" + selected);}}},

thanks in advance

got it…

on:{onSelectChange:function()
{ 
        var sel = $$("myTeam").getSelectedItem(true); // selection as array
        var cols = $$("myTeam").config.columns; // columns
        if (sel.length){
          var column = cols[0].id; // 2nd column
          var res = [];sel.forEach(function(obj){res.push(obj[column])
          });
          alert("team:" + res)
 }}}