stwe / DatatablesBundle

This Bundle integrates the jQuery DataTables plugin into your Symfony application.
355 stars 236 forks source link

Customizing template rendering and element placing #574

Open vctls opened 7 years ago

vctls commented 7 years ago

Hello,

Is there a way of changing how, and particularly where the action buttons are rendered?

For example, I want to put my table in a bootstrap panel, and the New button in the panel footer. I could override the templates, but any change I make would be applied to every datatable. Instead, it would be convenient to render the different parts of the datatable_html template separately as blocks. Something like:

<div class="panel panel-default">
    {{ datatable_render_block(datatable, table) }}
    <div class="panel-footer">
        {{ datatable_render_block(datatable, actions) }}
    </div>
</div>

Is there some way to do this in twig that I am not aware of? Or would it require adding a renderBlock() method in the twig extension? I tried overriding the whole DatatableTwigExtension, but with little success at the moment. Besides, it seems a bit overkill for my needs.

vctls commented 7 years ago

I'll be rendering those actions outside de datatable for now, without using the topActions.