waldo2188 / DatatableBundle

Symfony2 Ajax Datatable Bundle to simplify the use of http://datatables.net/ (and Doctrine entity inside)
MIT License
17 stars 16 forks source link

Twig Problem #3

Closed Xeyos88 closed 7 years ago

Xeyos88 commented 8 years ago

Hi, if i use this format

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.css"/>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.js"></script>

{{ datatable({
        'js' : {
            'ajax' : path('route_for_your_datatable_action')
        }
    })
}}
{{ datatable({
        'js' : {
            'ajax' : path('route_for_your_datatable_action')
        }
    })
}}

I don't see any

If i use this

% block body %}
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.css"/>
    {{ datatable_html({
            'id' : 'dta-offres'
        })
    }}

{% endblock %}

{% block javascripts %}
<script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.9/js/jquery.dataTables.js"></script>
{{ datatable_js({
        'id' : 'dta-offres',
        'js' : {
            'dom': '<"clearfix"lf>rtip',
            'ajax': path('route_for_your_datatable_action'),
        }
    })
}}
{% endblock javascripts %}

I see the results but i have the reinitialise datatable error DataTables warning: table id=dta-offres - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

Second question how can I have a rendering as in your example image?

Xeyos88 commented 8 years ago

Solved this part DataTables warning: table id=dta-offres - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3 but search filter doesn't work

if i add ->setSearch(true) i have this error DataTables warning: table id=dta-offres - Ajax error. For more information about this error, please see http://datatables.net/tn/7

waldo2188 commented 8 years ago

Hi, Which version of Datatable Bundle are you using ? Can you check if the route_for_your_datatable_action return a valid Json ?