使用Django排序呈现的jQuery数据表不起作用

问题描述

我似乎无法按此顺序订购这张桌子。该应用正在从Django检索表并成功呈现它。但是,当我继续并单击表格列顶部的箭头时,会有一个显示“正在处理”,但没有重新排序。当我以编程方式禁用serverSide使其仅在第一次出现时,无论如何都会发生ajax调用

    $(document).ready( function () {
        $.fn.dataTable.ext.errMode = 'throw';
        var table = $('#{{ grid_id }}').DataTable({
            "paging": {{paging}},"searching": false,"info": true,"stateSave": false,"orderable": true,"ordering": true,"processing": true,"serverSide": true
            {% if ajax_url is not None %},"ajax": {
                /* "type": "POST",*/
                "url": "{{ ajax_url }}","dataSrc": "results","data": function (d) {
                    d.customParam = "custom";
                }
            }{% endif %}{% if column_list is not None %},"columns": [
                {% for col in column_list %} { "title":"{{ col.title }}","data": "{{ col.data }}"
                {% if col.href is not None %},fnCreatedCell: function (nTd,sData,oData,iRow,iCol) { $(nTd).html("<a href='{{col.href}}"+oData.{{ col.href_data_attr }}+"'>"+oData.{{ col.data }}+"</a>");}{% endif %}
                },{% endfor %}
            ]
            {% endif %}
        });
    });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)