-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom column twig template problem #72
Comments
Hey, thank you for the kind words! :) I can confirm this is a bug, and I will try to fix this as soon as possible. |
…late when used with custom theme (#73)
Well, that was a quick fix :) Version 0.17.7 should be working properly in your case |
Whoa, that was super fast! Thank you so much! ❤ |
@kris-sum have you tried clearing the cache? Twig sometimes can be quite quirky 😅 This variable was added in the new version and is automatically added to the Twig context |
Yeah, I killed ./var/cache . I'll try again... |
Yeah that should do the trick. Maybe I was too hasty, I'm looking into it |
I was able to reproduce this issue by:
Previously I only tested a scenario where the block was properly defined in the template. In this scenario it should render the column as the text instead of throwing an error - working on a fix already. In the meantime, can you provide the contents of your column type class? And how exactly is it named? |
|
Okay, so this was caused by another bug, and I somehow never noticed that. Each column type has its own map of block prefixes. For example, your
When rendering, the bundle is trying to render header and value blocks using those block prefixes. Because you haven't specified the This is fixed in the version 0.17.8. Sorry for the inconvenience. Can you please update and verify whether it's working in your application? 😄 |
Definitely getting closer! But my block dies with this error:
|
Doh, it works if I include (i.e. copy) all the referenced blocks to be in the custom
|
@kris-sum Yeah, if you want to rely on the base theme blocks, you have to extend the template, or provide path to the template that contains the block (second argument of the {% block column_link_with_row_data_value %}
<a {% with { attr: { href, target }|merge(attr) } %}{{- block('attributes', '@KreyuDataTable/themes/base.html.twig') -}}{% endwith %}>
{{- block('column_text_value', '@KreyuDataTable/themes/base.html.twig') -}}
</a>
{% endblock %} See: https://twig.symfony.com/doc/3.x/functions/block.html Personally, in this case, I wouldn't bother and I would just extend the Bootstrap theme and use it alone, as you previously suggested as a workaround 😄 Thanks for help, two nasty bugs got fixed! |
Thanks for your super speedy response to this! Forgot you could provide the path to the block, that's a slightly cleaner solution for me, will implement it in my code. You should definitely add BuyMeACoffee to your repo , I owe you one! |
Hi,
Great package, i'm new to symfony (but not to php) and have been looking for a decent data table component to use and this is by far the best structured one! (thank you!)
I'm having a problem creating a new column type - following the guide , everything is fine except I can't get my twig template working.
I get the following exception:
I have
and
As a workaround, if I remove the bootstrap5 theme from
krey_data_table.yaml
and extend it in my twig template, it works fine.The text was updated successfully, but these errors were encountered: