title: Selecting single row on click in a data table
body: <p>I have been trying to select one row that is clicked on but the problem I am facing is that the table being paginated shows the selected row on different pages and does not show on other pages. </p>
  
  <p>I am simply removing and adding a css class on click on a row. </p>
  
  <p>something like - </p>
  
  <pre><code>function rowClicked (){ 
  
      var table = $('#test').DataTable();
  
      $('#test tbody').on( 'click','tr', function () {
          if ( $(this).hasClass('selected') ) {
              $(this).removeClass('selected');
              console.log('helloe 1');
          }
          else {
              table.$('tr.selected').removeClass('selected');
              $(this).addClass('selected');
                  console.log('helloe 3');
          }
      } );    
  
  
  }
  </code></pre>