Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
370 views
in Technique[技术] by (71.8m points)

django 1.8.6 django-datatable-view==0.8.2: export buttons not showing

I have an old django app that I am moving into a docker container. It uses:

Django==1.8.6
django-datatable-view==0.8.2
django-extensions==1.5.9
django-formtools==1.0

This is my template:

{% load static %}
{% autoescape off %}

<script src="{% static 'js/datatableview.js' %}"></script>
<script>
datatableview.auto_initialize = false;
$(function(){
        var table = datatableview.initialize($('.datatable'), {
            lengthMenu: [ [ 10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
        {% if editable %}
            fnRowCallback: datatableview.make_xeditable({}),
        {% endif %}
        {% if page_length %}
            bPaginate: true,
            iDisplayLength: {{ page_length }},
        {% else %}
            bPaginate: false,
        {% endif %}
        {% if filter %}
            bFilter: true,
        {% else %}
            bFilter: false,
        {% endif %}
        {% if dom %}
            sDom: '{% if export %}B{% endif %}{{ dom }}',
        {% else %}
            sDom: 'lrftip',
        {% endif %}
        {% if export %}
            buttons: [
                    "copy",
                    "print",
                    "csvHtml5",
                    "excelHtml5",
                    "pdfHtml5"
                ],


        {% endif %}
    });

});
</script>

{% endautoescape %}

and this is the result:

enter image description here

the working version (in another server and not running in a docker component) give this result:

enter image description here

as you can see I am missing the export buttons: Copy, Print, CSV, etc

Even if I remove the if statement around the buttons' code, the buttons are not showing:

{% endif %}
        {% if dom %}
            sDom: '{% if export %}B{% endif %}{{ dom }}',
        {% else %}
            sDom: 'lrftip',
        {% endif %}
       
            buttons: [
                    "copy",
                    "print",
                    "csvHtml5",
                    "excelHtml5",
                    "pdfHtml5"
                ],


       
    });

So I guess I am missing some css or js file but I cannot find any documentation specific to the version of the table I am using. Can anyone help?

question from:https://stackoverflow.com/questions/65848797/django-1-8-6-django-datatable-view-0-8-2-export-buttons-not-showing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...