jQuery addClass example

Change class name on click in jQuery

HTML

<link rel="stylesheet" href="https://nightly.datatables.net/css/jquery.dataTables.css">
<link rel="stylesheet" href="https://nightly.datatables.net/rowgroup/css/rowGroup.dataTables.css">
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<script src="https://nightly.datatables.net/rowgroup/js/dataTables.rowGroup.js"></script>
<table id="example" class="display" style="width:100%">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Tiger Nixon</td>
                <td>Accountant</td>
                <td>Edinburgh</td>
                <td>61</td>
                <td>2011/04/25</td>
                <td>$320,800</td>
            </tr>
            <tr>
                <td>Garrett Winters</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>63</td>
                <td>2011/07/25</td>
                <td>$170,750</td>
            </tr>
            <tr>
                <td>Ashton Cox</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>66</td>
                <td>2009/01/12</td>
                <td>$86,000</td>
            </tr>
            <tr>
                <td>Airi Satou</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>33</td>
                <td>2008/11/28</td>
                <td>$162,700</td>
            </tr>            
            <tr>
                <td>Paul Byrd</td>
                <td>Chief Financial Officer (CFO)</td>
                <td>New York</td>
                <td>64</td>
                <td>2010/06/09</td>
                <td>$725,000</td>
            </tr>
            <tr>
     ...

JavaScript

$(document).ready(function() {
	$('#example').DataTable(
		{
    orderFixed: [1, 2, 'asc'],
		rowGroup: {
			dataSrc: [1,2]
			},			
		//order: [[1,"asc"]]
		})
});