Skip to content
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

Loding language file from url discards column definition #87

Open
hbast opened this issue May 25, 2022 · 0 comments
Open

Loding language file from url discards column definition #87

hbast opened this issue May 25, 2022 · 0 comments

Comments

@hbast
Copy link

hbast commented May 25, 2022

Hello all,
I would like to load a language file as json during initialization instead of entering all translations manually. For this I wrote the following code

    <script type="text/javascript">
        $(document).ready(function() {
            AjaxDatatableViewUtils.initialize_table(
                $('#datatable_{{ event.slug }}'),
                "{% url 'issue_datatable' %}",
                {
                    processing: false,
                    autoWidth: true,
                    full_row_select: false,
                    scrollX: false,
                    language: {
                       url: "{% static 'datatables/de-DE.json' %}"
                    },
                }, {
                    slug: '{{ event.slug }}',
                }
            );
        });
    </script>

If I include the language package like this, all configurations I made in Python, e.g. autofilter or orderable settings are discarded. The table is rendered without autofilter and orderable. However, the language pack is loaded correctly.

If I enter the translations manually, as it says in the instructions, everything works fine.

I also tried putting the language + url inside AjaxDatatableViewUtils.init() but this didn't worked too.

Edit: this is the link to the language file:
https://cdn.datatables.net/plug-ins/1.12.0/i18n/de-DE.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant