mercredi 20 novembre 2019

How can i get the second column of all rows that have selected checkbox in datatables even from other pages

I have this table (generated data from controller spring mvc and thymeleaf object).
I want to choose data from multiple pages of my datatable.
And get all values of second columns selected checkboxes (as you see in the table it is named 'ID'). How can i do that?

$(document).ready(function(){
        var mytable = $("#maliste").DataTable({
            'columnDefs': [
                 {
                    'targets': 0,
                    className: 'select-checkbox',
                    'checkboxes': {
                       'selectRow': true
                    }
                 }
              ],

              'select': {
                 'style': 'multi'
              },
              'order': [[1, 'asc']],
              fixedHeader: true,
                searching : true,
                deferRender: true,
                paging : true,
                bProcessing : true,

                dom : 'iftlrp'
        });



        $('#selection').click( function () {

            //i want to have informations here 
        } );

Here is html table :

<p><button id="selection"  class="btn btn-danger"> THIS IS BUTTON TO GET SELECTION</button> <br></p>
        <table id="maliste" class="table table-striped table-bordered table-sm table-hover">
            <thead>
            <tr>
                <th></th><!--  FOR CHECKBOXES -->
                <th>ID</th>
                <th>STRUCTURE</th>
                <th>CLIENT</th>
                <th>ANNEE</th>
            </tr>
            </thead>
            <tr th:each="boite : ${liste}">
                <td ></td>
                <td th:text="${boite.id}"></td>
                <td th:text="${boite.structure}"></td>
                <td th:text="${boite.client}"></td>
                <td th:text="${boite.annee}" style="white-space: pre-line"></td>
            </tr>
            <tfoot>
            <tr>
                <th></th><!--  FOR CHECKBOXES -->
                <th>ID</th>
                <th>STRUCTURE</th>
                <th>CLIENT</th>
                <th>ANNEE</th>
            </tr>
            </tfoot>
        </table>

Here it is the page how it looks, i want when i click on the button to get list of ids and send to controller form exemple to localhost:8080/send_ids Text




Aucun commentaire:

Enregistrer un commentaire