Search code examples
mysqllaraveltabulator

tabulator table doesn't render some column values. wondering why?


i got a temporary table which is created from procedure. i'm assigning it to the variable which is then converted to json and passed to the view of my laravel project. when i load my page table is rendered but some column values are missing.i wonder why?

i've run it in MySQL Workbench and all the data shows up normally. here is the HTML result of it: https://jsfiddle.net/iBek23/z5pdsjob/

controller:

    public function tabulator(){

        DB::select("CALL report1a_respublika('2000/01/01', '2023/01/01')");
        $one = DB::select("SELECT * FROM test");

        $one = json_encode($one);

        return view ('reports.tabulator', compact('one'));

view:

{{-- tabulator tables --}}
<div style='display:none' id="tableZero"></div>
<div id="tableOne" style="margin-top:15px"></div>


{{-- tabulator script --}}
<script>

    //define data for table1
    var tabledata1 = {!!$one!!}

    var table0 = new Tabulator("#tableZero", {
    layout: "fitDataFill", //fit columns to width of table (optional)
    autoColumns: true,
    });

    //define table1
    var table1 = new Tabulator("#tableOne", {
        data: tabledata1,
        autoColumns:true,
        layout:"fitDataFill",
        movableColumns:true,
        selectable:true,
        clipboard:true,
    });

    //trigger download of data.xlsx file
    var sheets = {
    "sheetA": table1,
    };

    downloadXlxs = function(){
    table0.download("xlsx", "report.xlsx", {sheets:sheets});
    };  

</script>

here is what i get: https://jsfiddle.net/iBek23/wf0xernz/5/

columns 5,6 and 7 (counting from left to right) don't have any values.


Solution

  • Replace Period '.' with &#46;
    

    see this jsfiddle you can see first item, repeat this

    &#46;\u0411\u0438\u0448\u043a\u0435\u043a":12,