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

dont show column filters #101

Open
alexeydg opened this issue Mar 1, 2023 · 4 comments
Open

dont show column filters #101

alexeydg opened this issue Mar 1, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@alexeydg
Copy link

alexeydg commented Mar 1, 2023

Hello, in your demo has flters
image
in my example they don't show
image

model = Product
    title = 'каталог'
    initial_order = [["name", "asc"], ]
    length_menu = [[10, 20, 50, 100, -1], [10, 20, 50, 100, 'all']]
    search_values_separator = '+'

    column_defs = [
        {'name': 'sku', 'visible': True, 'title': 'Артикул'},
        {'name': 'name', 'visible': True, 'placeholder': True, 'title': 'Название товара'},
        {'name': 'brand', 'foreign_field': 'brand__name', 'visible': True,},
        {'name': 'brand_id', 'visible': True,},
        {'name': 'buttons', 'visible': True, 'placeholder': True, 'searchable': False, 'width': '300',
            'orderable': False, 'title': ''}
    ]
....
<script language="javascript">
        $(document).ready(function() {
            AjaxDatatableViewUtils.initialize_table(
                $('#datatable_product'),
                "{% url 'ecom:ajax_datatable_ecom_product' %}",
                {
                    // extra_options (example)
                    processing: false,
                    autoWidth: false,
                    full_row_select: false,
                    scrollX: false,
                    language: {
                       url: "/static/plugins/datatables/ru.json"
                    },
                }, {
                    // extra_data
                },
            );
        });

    </script>
@alexeydg
Copy link
Author

alexeydg commented Mar 2, 2023

I found a bug, if you connect the translation from the json file, then the filter is not shown

language: {
                       url: "/static/plugins/datatables/ru.json"
                    },

@hbast
Copy link

hbast commented Sep 19, 2023

I can confirm the behavior described above. The filter are gone after activating the translation via the json file. I used the german translation file.

@morlandi
Copy link
Owner

Oh, thank you ... that's really puzzling, isn't it?

I will label this issue as a bug and sooner or later hopefully investigate it.

In the meantime, a quick and dirty workaround, although not very elegant, could be:

language: {
	"sProcessing":   "Подождите...",
	"sLengthMenu":   "Показать _MENU_ записей",
	"sZeroRecords":  "Записи отсутствуют.",
	"sInfo":         "Записи с _START_ до _END_ из _TOTAL_ записей",
	"sInfoEmpty":    "Записи с 0 до 0 из 0 записей",
	"sInfoFiltered": "(отфильтровано из _MAX_ записей)",
	"sInfoPostFix":  "",
	"sSearch":       "Поиск:",
	"sUrl":          "",
	"oPaginate": {
		"sFirst": "Первая",
		"sPrevious": "Предыдущая",
		"sNext": "Следующая",
		"sLast": "Последняя"
	},
	"oAria": {
		"sSortAscending":  ": активировать для сортировки столбца по возрастанию",
		"sSortDescending": ": активировать для сортировки столбцов по убыванию"
	}
}

instead of

language: {
    url: "https://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Russian.json"
}

@morlandi morlandi added the bug Something isn't working label Sep 19, 2023
@hbast
Copy link

hbast commented Sep 20, 2023

see also #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants