<!DOCTYPE html>
<html>
  <head>
    <script src="https://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 src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
    <meta charset=utf-8 />
    <title>DataTables - JS Bin</title>
  </head>
  <body>
    <div class="container">
      <form action="" method="post" id="form_crea_preventivo_figlio" name="form_crea_preventivo_figlio">
      <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><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>System Architect</td>
            <td>Edinburgh</td>
            <td>61</td>
            <td>2011/04/25</td>
            <td>$3,120</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Director</td>
            <td>Edinburgh</td>
            <td>63</td>
            <td>2011/07/25</td>
            <td>$5,300</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Technical Author</td>
            <td>San Francisco</td>
            <td>66</td>
            <td>2009/01/12</td>
            <td>$4,800</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Javascript Developer</td>
            <td>Edinburgh</td>
            <td>22</td>
            <td>2012/03/29</td>
            <td>$3,600</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Financial Controller</td>
            <td>Edinburgh</td>
            <td>33</td>
            <td>2008/11/28</td>
            <td>$5,300</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Integration Specialist</td>
            <td>New York</td>
            <td>61</td>
            <td>2012/12/02</td>
            <td>$4,525</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Sales Assistant</td>
            <td>San Francisco</td>
            <td>59</td>
            <td>2012/08/06</td>
            <td>$4,080</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Integration Specialist</td>
            <td>Edinburgh</td>
            <td>55</td>
            <td>2010/10/14</td>
            <td>$6,730</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Javascript Developer</td>
            <td>San Francisco</td>
            <td>39</td>
            <td>2009/09/15</td>
            <td>$5,000</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Software Engineer</td>
            <td>Edinburgh</td>
            <td>23</td>
            <td>2008/12/13</td>
            <td>$3,600</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>System Architect</td>
            <td>London</td>
            <td>30</td>
            <td>2008/12/19</td>
            <td>$5,000</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Financial Controller</td>
            <td>Edinburgh</td>
            <td>22</td>
            <td>2013/03/03</td>
            <td>$4,200</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Regional Director</td>
            <td>San Francisco</td>
            <td>36</td>
            <td>2008/10/16</td>
            <td>$5,300</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Senior Marketing Designer</td>
            <td>London</td>
            <td>43</td>
            <td>2012/12/18</td>
            <td>$4,800</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Regional Director</td>
            <td>London</td>
            <td>19</td>
            <td>2010/03/17</td>
            <td>$2,875</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Senior Marketing Designer</td>
            <td>London</td>
            <td>66</td>
            <td>2012/11/27</td>
            <td>$3,750</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Javascript Developer</td>
            <td>New York</td>
            <td>64</td>
            <td>2010/06/09</td>
            <td>$5,000</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Systems Administrator</td>
            <td>New York</td>
            <td>59</td>
            <td>2009/04/10</td>
            <td>$3,120</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Software Engineer</td>
            <td>London</td>
            <td>41</td>
            <td>2012/10/13</td>
            <td>$3,120</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>System Architect</td>
            <td>Edinburgh</td>
            <td>35</td>
            <td>2012/09/26</td>
            <td>$4,200</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Financial Controller</td>
            <td>New York</td>
            <td>30</td>
            <td>2011/09/03</td>
            <td>$4,965</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>System Architect</td>
            <td>New York</td>
            <td>40</td>
            <td>2009/06/25</td>
            <td>$3,600</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Technical Author</td>
            <td>New York</td>
            <td>21</td>
            <td>2011/12/12</td>
            <td>$4,965</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Sales Assistant</td>
            <td>Edinburgh</td>
            <td>23</td>
            <td>2010/09/20</td>
            <td>$4,965</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>System Architect</td>
            <td>London</td>
            <td>36</td>
            <td>2009/10/09</td>
            <td>$2,875</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Developer</td>
            <td>Edinburgh</td>
            <td>42</td>
            <td>2010/12/22</td>
            <td>$4,525</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Regional Director</td>
            <td>London</td>
            <td>28</td>
            <td>2010/11/14</td>
            <td>$4,080</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Software Engineer</td>
            <td>San Francisco</td>
            <td>18</td>
            <td>2011/06/07</td>
            <td>$3,750</td>
          </tr>
          <tr>
            <td><input type="checkbox" name="meta_descrizione_preventivo[]" class="input-attributo" /></td>
            <td>Software Engineer</td>
            <td>San Francisco</td>
            <td>48</td>
            <td>2010/03/11</td>
            <td>$2,875</td>
          </tr>
        </tbody>
      </table>
        <button type="submit" name="button_inserisci_preventivo_figlio"
                                            id="button_inserisci_preventivo_figlio" class="btn btn-success btn-md"><i
                                                class="bi bi-pencil-square"></i> Insert</button>
      </form>
    </div>
  </body>
</html>
 
body {
  font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}
 
$(document).ready( function () {
  
  
            
         $('#form_crea_preventivo_figlio').submit(function(e) {
            e.preventDefault();
            var formname = "#form_crea_preventivo_figlio";
            //var querystring = $('#form_crea_preventivo').serialize();
           
                var formData = new FormData();
                var orderValue = {};
                var multipleValue = [];
           $(formname)
                    .find(":checkbox:checked, :radio:checked")
                    .each(function () {
                    var input = $(this);
                    orderValue = {
                        id: input.attr("id"),
                        valore: input.val().replace(/\n/g, "<br />"),
                        nome_campo: input.attr("name"),
                    };
                    multipleValue.push(orderValue);
                    });
           
                   formData.append("querystring", JSON.stringify(multipleValue));
           
           for (let [name, value] of formData) {
                    alert(value); // key1 = value1, then key2 = value2
                }
            
        });
  
  
  
  var table = $('.display').DataTable({
                dom: 'lfr<"onefilter">tipB',
                stateSave: false,
                lengthMenu: [
                    [5, 25, 50, -1],
                    [5, 25, 50, "Tutti"]
                ],
                buttons: [
                    
                ],
                language: {
                    "zeroRecords": "Nessun risultato",
                    "info": "Pagina _PAGE_ di _PAGES_ (_MAX_ risultati totali)",
                    "infoEmpty": "Nessun risultato disponibile",
                    "infoFiltered": "",
                    "search": "Cerca:",
                    "paginate": {
                        "first": "Prima",
                        "last": "Ultima",
                        "next": "Successiva",
                        "previous": "Precedente"
                    },
                    "lengthMenu": "Mostra _MENU_ risultati",
                },
                order: [
                    [0, "desc"]
                ],
                initComplete: function() {
                    var tableWrapperId='#'+this[0].id+'_wrapper';
                    this.api().columns([2]).every(function() {
                        
                        var column = this;
                        var nomeColonna = column.header().textContent;
                        var select = $(
                                '<select class="form-control select-filtro-'+ nomeColonna +'"><option value="">- Filtra per ' +
                                nomeColonna + ' -</option></select>')
                            //.appendTo($(column.footer()).empty())
                            .appendTo($(tableWrapperId).find('.onefilter'))
                            .on('change', function() {
                                var val = $.fn.dataTable.util.escapeRegex(
                                    $(this).val()
                                );
                                column
                                    .search(val ? '^' + val + '$' : '', true, false)
                                    .draw();
                            });
                        column.data().unique().sort().each(function(d, j) {
                            select.append('<option value="' + d + '">' + d +
                                '</option>');
                        });
                        select.wrap($(
                            '<div class="col-lg-12 contenitore-filtro-datatable contenitore-filtro-'+ nomeColonna +'">'
                        ));
                    });
                },
            }); //datatables
  
  
});
3 warnings
Line 29: 'for of' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).
Line 29: 'let' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).
Line 29: 'destructuring expression' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).
Output 300px

This bin was created anonymously and its free preview time has expired. Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers