DATATTBALE SOT ISSUE

DATATTBALE SOT ISSUE

akash.guptaakash.gupta Posts: 3Questions: 0Answers: 0

hI.
ON\CE I AM GOING TO SORT DATA ON PARTICULAR LIST DATATABLE HAVING ISSSUE.
LIKE
IN8
IN100
IN101
IN10

PLEASE HELP ME OUT AND SUGGEST NEEDFUL.
ITS DATATABLE ISSUE.

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @akash.gupta ,

    We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    Try the Natural Sorting plugin.

    Kevin

  • akash.guptaakash.gupta Posts: 3Questions: 0Answers: 0

    Is natural sorting plugin works for datatable v1.9?

  • akash.guptaakash.gupta Posts: 3Questions: 0Answers: 0
    edited August 2018

    Hi Collin.
    i am pasting my whole code here, please look once.

    <!DOCTYPE html>
    <html>
      <head>
        <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    
        <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
     <script src="//cdn.datatables.net/plug-ins/1.10.19/sorting/natural.js"></script>
        <script>$(document).ready( function () {
      var table = $('#example').DataTable();
    } );</script>
        <meta charset=utf-8 />
        <title>DataTables - JS Bin</title>
      </head>
      <body>
        <div class="container">
          <table id="example" class="display nowrap" 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>
    
            <tfoot>
              <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
              </tr>
            </tfoot>
    
            <tbody>
             
              
              <tr>
                <td>IN8</td>
                <td>Technical Author</td>
                <td>San Francisco</td>
                <td>66</td>
                <td>2009/01/12</td>
                <td>$4,800</td>
              </tr>
              <tr>
                <td>IN100</td>
                <td>Javascript Developer</td>
                <td>Edinburgh</td>
                <td>22</td>
                <td>2012/03/29</td>
                <td>$3,600</td>
              </tr>
              <tr>
                <td>IN101</td>
                <td>Financial Controller</td>
                <td>Edinburgh</td>
                <td>33</td>
                <td>2008/11/28</td>
                <td>$5,300</td>
              </tr>
             
              <tr>
                <td>IN10</td>
                <td>System Architect</td>
                <td>New York</td>
                <td>27</td>
                <td>2011/01/25</td>
                <td>$3,120</td>
              </tr>
            </tbody>
          </table>
        </div>
      </body>
    </html>
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    As Kevin said, give the natural sorting a try - you've reference the JS but haven't configured your column to be of that type. Look at the example at the end of the page that Kevin sent.

    C

This discussion has been closed.