flask pandas to tabulator tables are all messed up












0















I'm a new Dev , trying to pass Pandas DataFram to Tabulator , it works but the table is so messed up



original file :
original file in excel



without tabulator :
to_html() render result



it renders fine as html but once i attach Tabulator to it everything is messed up .



after tabulator:
after attaching tabulator to it using ID



the way i install it was copying and pasting all files in Dist to my app folder JS files in the JS folder and all CSS files in CSS folder



in HTML head :



<link href="{{ url_for ('static', filename='css/tabulator.min.css') }}" rel="stylesheet"></link>


<script type="text/javascript" src="{{ url_for ('static', filename='tabulator.min.js') }}"></script>


HTML Body :



var table = new Tabulator("#tableId", {});


PYTHON :



df = pd.read_excel(destination)

return render_template('fileviewer.html',x=df.to_html(table_id='tableId'))









share|improve this question

























  • can you post a sample of you html code (including table headers) and i can point you in the right direction

    – Oli Folkerd
    Nov 25 '18 at 18:43











  • that's how it's rendered from the back end >> pastebin.com/BkUVMJAr

    – za001a
    Nov 25 '18 at 18:50











  • the issue is that it is using th elements for the table cells instead of td elements. th elements should only be used in the thead not the tbody

    – Oli Folkerd
    Nov 25 '18 at 18:51











  • this how Panda render's it , i can render it in json as well , could it work with json ?

    – za001a
    Nov 25 '18 at 18:54











  • i would check with panda as that isnt valid HTML unfortunately. Yes Tabulator certainly can work with JSON, no problem there! have a look at tabulator.info/docs/4.1/data#array the function will take either an array of data or JSON encoded array

    – Oli Folkerd
    Nov 25 '18 at 18:55


















0















I'm a new Dev , trying to pass Pandas DataFram to Tabulator , it works but the table is so messed up



original file :
original file in excel



without tabulator :
to_html() render result



it renders fine as html but once i attach Tabulator to it everything is messed up .



after tabulator:
after attaching tabulator to it using ID



the way i install it was copying and pasting all files in Dist to my app folder JS files in the JS folder and all CSS files in CSS folder



in HTML head :



<link href="{{ url_for ('static', filename='css/tabulator.min.css') }}" rel="stylesheet"></link>


<script type="text/javascript" src="{{ url_for ('static', filename='tabulator.min.js') }}"></script>


HTML Body :



var table = new Tabulator("#tableId", {});


PYTHON :



df = pd.read_excel(destination)

return render_template('fileviewer.html',x=df.to_html(table_id='tableId'))









share|improve this question

























  • can you post a sample of you html code (including table headers) and i can point you in the right direction

    – Oli Folkerd
    Nov 25 '18 at 18:43











  • that's how it's rendered from the back end >> pastebin.com/BkUVMJAr

    – za001a
    Nov 25 '18 at 18:50











  • the issue is that it is using th elements for the table cells instead of td elements. th elements should only be used in the thead not the tbody

    – Oli Folkerd
    Nov 25 '18 at 18:51











  • this how Panda render's it , i can render it in json as well , could it work with json ?

    – za001a
    Nov 25 '18 at 18:54











  • i would check with panda as that isnt valid HTML unfortunately. Yes Tabulator certainly can work with JSON, no problem there! have a look at tabulator.info/docs/4.1/data#array the function will take either an array of data or JSON encoded array

    – Oli Folkerd
    Nov 25 '18 at 18:55
















0












0








0








I'm a new Dev , trying to pass Pandas DataFram to Tabulator , it works but the table is so messed up



original file :
original file in excel



without tabulator :
to_html() render result



it renders fine as html but once i attach Tabulator to it everything is messed up .



after tabulator:
after attaching tabulator to it using ID



the way i install it was copying and pasting all files in Dist to my app folder JS files in the JS folder and all CSS files in CSS folder



in HTML head :



<link href="{{ url_for ('static', filename='css/tabulator.min.css') }}" rel="stylesheet"></link>


<script type="text/javascript" src="{{ url_for ('static', filename='tabulator.min.js') }}"></script>


HTML Body :



var table = new Tabulator("#tableId", {});


PYTHON :



df = pd.read_excel(destination)

return render_template('fileviewer.html',x=df.to_html(table_id='tableId'))









share|improve this question
















I'm a new Dev , trying to pass Pandas DataFram to Tabulator , it works but the table is so messed up



original file :
original file in excel



without tabulator :
to_html() render result



it renders fine as html but once i attach Tabulator to it everything is messed up .



after tabulator:
after attaching tabulator to it using ID



the way i install it was copying and pasting all files in Dist to my app folder JS files in the JS folder and all CSS files in CSS folder



in HTML head :



<link href="{{ url_for ('static', filename='css/tabulator.min.css') }}" rel="stylesheet"></link>


<script type="text/javascript" src="{{ url_for ('static', filename='tabulator.min.js') }}"></script>


HTML Body :



var table = new Tabulator("#tableId", {});


PYTHON :



df = pd.read_excel(destination)

return render_template('fileviewer.html',x=df.to_html(table_id='tableId'))






javascript python pandas flask tabulator






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 18:10







za001a

















asked Nov 25 '18 at 17:54









za001aza001a

909




909













  • can you post a sample of you html code (including table headers) and i can point you in the right direction

    – Oli Folkerd
    Nov 25 '18 at 18:43











  • that's how it's rendered from the back end >> pastebin.com/BkUVMJAr

    – za001a
    Nov 25 '18 at 18:50











  • the issue is that it is using th elements for the table cells instead of td elements. th elements should only be used in the thead not the tbody

    – Oli Folkerd
    Nov 25 '18 at 18:51











  • this how Panda render's it , i can render it in json as well , could it work with json ?

    – za001a
    Nov 25 '18 at 18:54











  • i would check with panda as that isnt valid HTML unfortunately. Yes Tabulator certainly can work with JSON, no problem there! have a look at tabulator.info/docs/4.1/data#array the function will take either an array of data or JSON encoded array

    – Oli Folkerd
    Nov 25 '18 at 18:55





















  • can you post a sample of you html code (including table headers) and i can point you in the right direction

    – Oli Folkerd
    Nov 25 '18 at 18:43











  • that's how it's rendered from the back end >> pastebin.com/BkUVMJAr

    – za001a
    Nov 25 '18 at 18:50











  • the issue is that it is using th elements for the table cells instead of td elements. th elements should only be used in the thead not the tbody

    – Oli Folkerd
    Nov 25 '18 at 18:51











  • this how Panda render's it , i can render it in json as well , could it work with json ?

    – za001a
    Nov 25 '18 at 18:54











  • i would check with panda as that isnt valid HTML unfortunately. Yes Tabulator certainly can work with JSON, no problem there! have a look at tabulator.info/docs/4.1/data#array the function will take either an array of data or JSON encoded array

    – Oli Folkerd
    Nov 25 '18 at 18:55



















can you post a sample of you html code (including table headers) and i can point you in the right direction

– Oli Folkerd
Nov 25 '18 at 18:43





can you post a sample of you html code (including table headers) and i can point you in the right direction

– Oli Folkerd
Nov 25 '18 at 18:43













that's how it's rendered from the back end >> pastebin.com/BkUVMJAr

– za001a
Nov 25 '18 at 18:50





that's how it's rendered from the back end >> pastebin.com/BkUVMJAr

– za001a
Nov 25 '18 at 18:50













the issue is that it is using th elements for the table cells instead of td elements. th elements should only be used in the thead not the tbody

– Oli Folkerd
Nov 25 '18 at 18:51





the issue is that it is using th elements for the table cells instead of td elements. th elements should only be used in the thead not the tbody

– Oli Folkerd
Nov 25 '18 at 18:51













this how Panda render's it , i can render it in json as well , could it work with json ?

– za001a
Nov 25 '18 at 18:54





this how Panda render's it , i can render it in json as well , could it work with json ?

– za001a
Nov 25 '18 at 18:54













i would check with panda as that isnt valid HTML unfortunately. Yes Tabulator certainly can work with JSON, no problem there! have a look at tabulator.info/docs/4.1/data#array the function will take either an array of data or JSON encoded array

– Oli Folkerd
Nov 25 '18 at 18:55







i would check with panda as that isnt valid HTML unfortunately. Yes Tabulator certainly can work with JSON, no problem there! have a look at tabulator.info/docs/4.1/data#array the function will take either an array of data or JSON encoded array

– Oli Folkerd
Nov 25 '18 at 18:55














1 Answer
1






active

oldest

votes


















0














Looking at the code you posted, the issue is that it is using th tags for the first cell of each row in the table instead of td tags. th tags should only be used in the thead not the tbody






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53470273%2fflask-pandas-to-tabulator-tables-are-all-messed-up%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Looking at the code you posted, the issue is that it is using th tags for the first cell of each row in the table instead of td tags. th tags should only be used in the thead not the tbody






    share|improve this answer




























      0














      Looking at the code you posted, the issue is that it is using th tags for the first cell of each row in the table instead of td tags. th tags should only be used in the thead not the tbody






      share|improve this answer


























        0












        0








        0







        Looking at the code you posted, the issue is that it is using th tags for the first cell of each row in the table instead of td tags. th tags should only be used in the thead not the tbody






        share|improve this answer













        Looking at the code you posted, the issue is that it is using th tags for the first cell of each row in the table instead of td tags. th tags should only be used in the thead not the tbody







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 18:53









        Oli FolkerdOli Folkerd

        1,54311116




        1,54311116






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53470273%2fflask-pandas-to-tabulator-tables-are-all-messed-up%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)