django-ajax-datatable icon indicating copy to clipboard operation
django-ajax-datatable copied to clipboard

dont show column filters

Open alexeydg opened this issue 2 years ago • 4 comments

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 avatar Mar 01 '23 11:03 alexeydg

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"
                    },

alexeydg avatar Mar 02 '23 07:03 alexeydg

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.

hbast avatar Sep 19 '23 14:09 hbast

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 avatar Sep 19 '23 16:09 morlandi

see also https://github.com/morlandi/django-ajax-datatable/issues/87

hbast avatar Sep 20 '23 07:09 hbast