0
votes
        This is my init code:
           $(document).ready( function () {
        $('#companies').dataTable( {
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
        "sRowSelect": "multi",
        "aButtons": [ "select_all", "select_none" ]
    }
        } );
               } );

         This is my body code:
             <body id="dt_example">
             <div id="container">

        <div id="demo_jui">
        <table id="companies" class="display">
         <thead>
     <tr>
        <th>Company name</th>
        <th>Address</th>
        <th>Town</th>
    </tr>
         </thead>
       <tbody>
    <tr>
        <td>ABC</td>
        <td>ABC Street</td>
        <td>Town1</td>
    </tr>
    <tr>
        <td>Dell</td>
        <td>Car street</td>
        <td>Town2</td>
    </tr>

          </tbody>
                </table>
                </div>

                  </div>
                   </body>

I don't know, what is wrong here. I'm not getting 'select all' and 'deselect all' buttons and also i can't select single row. I have followed the example from this link: http://datatables.net/release-datatables/extras/TableTools/select_multi.html. I'm new to Jquery and Datatables plugin. Kindly help me to resolve this issue.

1

1 Answers

0
votes

You have to add TableTools.js and TableTools.css to your Layout page, or individual View (Layout page recommended).

 <script src="../../Scripts/dataTables/media/js/TableTools.js"
 type="text/javascript"></script>

<link href="../../Scripts/dataTables/media/css/TableTools.css" rel="stylesheet" type="text/css" />

By default those 2 files are located in

DataTable-VersionNumber/extras/TableTools/css

DataTable-VersionNumber/extras/TableTools/js.

You can easily drag those 2 files to your main dataTable folder in Visual Studio.