Search code examples
javascriptoracle-jet

can't get the values of selected row in Oracle Jet ojetable


i have an oracle jet table which is like that

 <table data-bind="event: {ojbeforecurrentrow: currentRowListener},
      selectionMode: {row: 'single'},
      ojComponent: {component: 'ojTable', 
        data: dataSource,
        columns: [
            {headerText: 'Student Id', field: 'Id'},
            {headerText: 'FirstName', field: 'FirstName'},
            {headerText: 'LastName', field: 'LastName'},
            {headerText: 'BirthDate', field: 'BirthDate'},
            {headerText: 'Gender', field: 'Gender'}
        ]
    }">
</table> 

and the js file looks like that

self.currentRowListener = function (event,ui) {
      var current = ui.currentRow;
          alert(current);
           };

the alert value is Undefined , so i can't get the value of selected row

to set it in input text

what seems to be the problem


Solution

  • You can check this:

    self.currentRowListener = function (event) {
         {
                var data = event.detail;
                var newCurrentRow = data.currentRow;
                alert(newCurrentRow );
                var oldCurrentRow = data.previousCurrentRow;
    
        }
    

    For reference for selectionListener Oracle Jet Table Events