DatatablesBundle icon indicating copy to clipboard operation
DatatablesBundle copied to clipboard

Extensions should be more dynamic

Open stephanvierkant opened this issue 6 years ago • 2 comments

I'd like to use the FixedColumns extension, but that requires changing \Sg\DatatablesBundle\Datatable\Extensions and Resources/views/datatable/extensions.html.twig.

I can create a PR to add this feature, but I feel like this shouldn't be needed. I love OOP, but this seems over engineered. Configuring the OptionsResolver and using Twig to generate JSON is quite overkill, isn't it?

As an example, see 87d122ce0f6c9a1d8541dbe189e6df7e9a8eb1ee. It's a very complex, inflexible and over-engineered way of printing a JSON string.

Replacing \Sg\DatatablesBundle\Datatable\Extensions by an array makes more sense. Datatables.net's JS library should be use to handle configuration errors in this case.

What do you think?

stephanvierkant avatar Sep 18 '18 12:09 stephanvierkant

I completely agree.

Moreover, this could improve the performance by avoiding including a lot of Twig templates.

philippemilink avatar Sep 18 '18 17:09 philippemilink

Ping @stwe @Seb33300

Please let me know how you think about this idea. I'm willing to create a PR, but I'd like to know if this PR makes a chance in the first place.

stephanvierkant avatar Oct 19 '18 08:10 stephanvierkant