Releases: Kreyu/data-table-bundle
v0.33.0
What's Changed
- Allow Symfony 8 by @daFish in #254
- Remove useless import of the bootstrap modal by @alexandre-castelain in #253
- Fix Twig deprecated message from DataTableExtension by @davidnectarestudio in #249
Full Changelog: v0.32.2...v0.33.0
v0.32.2
What's Changed
- Fix not including personalization in export process still includes set personalization
Full Changelog: v0.32.1...v0.32.2
v0.32.1
What's Changed
- Changing items per page did not update the url query parameter #158 by @alexandre-castelain in #242
Full Changelog: v0.32.0...v0.32.1
v0.32.0
What's Changed
- Fix some default filters are not included in URL query params by @maciazek in #228
- Improve integration with Turbo to allow returning a single frame from controller by @alexandre-castelain in #235
- Fix profiler page when pagination is disabled by @Kreyu in #237
- Use closures instead of callables in action options by @Kreyu
- Improve Bootstrap 5 & Tabler themes to use "data_table_theme_block" function and "attributes" macro for better theming by @Kreyu
- Allow overriding attributes of
action_filter,action_exportandaction_personalizeblocks in Tabler theme by @Kreyu
Closures instead of callables in action options
Previously, all built-in action types had options that accepted callable values. This created an unexpected behavior when provided with a string that is callable. For example, take a look at this simple definition:
$builder->addRowAction('download', ButtonActionType::class, [
'icon' => 'file',
]);The provided string "file" is a callable - and it calls the PHP's file function, which would throw an exception:
file(): Argument #1 ($filename) must be of type string, <Some\Example\Entity> given
Now, all built-in actions require passing a \Closure instead of callable when necessary.
Warning
While this is a breaking change, it will break only if you relied on this unexpected behavior, or if you've used invokable classes for those options. Use closures when necessary.
Improved integration with Turbo
The new improved integration with Turbo allows to return a single data table from the controller, making it a perfect fit for pages with multiple data tables. For example:
use Kreyu\Bundle\DataTableBundle\DataTableFactoryAwareTrait;
use Kreyu\Bundle\DataTableBundle\DataTableTurboResponseTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ProductController extends AbstractController
{
use DataTableFactoryAwareTrait;
use DataTableTurboResponseTrait;
public function index(ProductRepository $productRepository, Request $request): Response
{
$query = $productRepository->createQueryBuilder('product');
$dataTable = $this->createDataTable(ProductDataTableType::class, $query);
$dataTable->handleRequest($request);
if ($dataTable->isRequestFromTurboFrame()) {
// Return only the table's HTML so Turbo can replace the requesting <turbo-frame>
return $this->createDataTableTurboResponse($dataTable);
}
// Rest of the controller logic we don't want to execute each time user interacts with the data table
// Initial (non-Turbo) request: render the full page
return $this->render('home/index.html.twig', [
'products' => $dataTable->createView(),
]);
}
}You can read more about this feature in https://data-table-bundle.swroblewski.pl/docs/features/asynchronicity.html#server-side-responses-for-turbo-frames
Full Changelog: v0.31.2...v0.32.0
v0.31.2
What's Changed
Fixed an issue where loading the data table state into the URL with Hotwire Turbo enabled would push into the history instead of replacing it. In this case, navigating back in the browser would require the user to do it twice #222
Note
If you're not using asset mapper, remember to reinstall & rebuild the assets!
Full Changelog: v0.31.1...v0.31.2
v0.31.1
What's Changed
- Fixed spacing between global actions in Bootstrap 5 theme action bar - instead of relying on whitespace, now actions are separated using
gap-1class
Full Changelog: v0.31.0...v0.31.1
v0.31.0
What's Changed
This release adds the ability to clear the sorting on third click (#225 #121). It was always cycling between ascending and descending, and now, by default, it cycles between ascending, descending and none (not sorted).
Old behavior can be restored by setting the sorting_clearable option of the data table types to false, or use configuration file to globally set a default value.
For more details, read the documentation here: https://data-table-bundle.swroblewski.pl/docs/features/sorting.html#clearing-the-sorting
Full Changelog: v0.30.4...v0.31.0
v0.30.4
v0.30.3
What's Changed
- Add Czech translations by @FluffyDiscord in #214
- Fix actions not visible if no filters, exports or personalization is enabled by @dbu in #221
- Improve documentation about case insensitive filters by @dbu in #220
- Improve documentation about case insensitive sorting by @dbu in #223
New Contributors
- @FluffyDiscord made their first contribution in #214
- @dbu made their first contribution in #220
Full Changelog: v0.30.2...v0.30.3