Search code examples
javascriptjqueryhtmlspring-bootthymeleaf

Thymeleaf does not Serialize the object


I had trying to display a bootstrap modal when i click a row with the extra data but when y try to print the object , it does not work:

<table id="datatable" class="table table-striped table-bordered">
    <thead>
    <tr>
        <th># Factura</th>
        <th>Cliente</th>
        <th>Fecha</th>
        <th>Accion</th>
    </tr>
    </thead>

    <tbody>
    <tr th:each="bill : ${bills}">
        <td th:text="${bill.bill_id}"></td>
        <td th:text="${bill.client.name}"></td>
        <td th:text="${bill.date}"></td>
        <td>
            <a class="btn btn-info btn-xs open-modal" data-whatever="[[{$bill}]]" data-toggle="modal" data-target="#billModal">Ver Detalles</a>
        </td>
    </tr>
    </tbody>
</table>

so, i dont know how to that bill object and send it to the modal, i have tried many ways.And it only serialize when i put with th:text or th:value


Solution

  • th:attr="data-whatever=${bill}"