【问题标题】:tabulator table doesn't render some column values. wondering why?制表符表不呈现某些列值。想知道为什么?
【发布时间】:2019-04-30 06:30:10
【问题描述】:

我有一个从过程创建的临时表。我将它分配给变量,然后将其转换为 json 并传递给我的 laravel 项目的视图。当我加载我的页表时,会呈现一些列值。我想知道为什么?

我已经在 MySQL Workbench 中运行它,所有数据都正常显示。这是它的 HTML 结果:https://jsfiddle.net/iBek23/z5pdsjob/

控制器:

    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'));

查看:

{{-- 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>

这是我得到的:https://jsfiddle.net/iBek23/wf0xernz/5/

第 5,6 列和第 7 列(从左到右计数)没有任何值。

【问题讨论】:

  • 我发现如果我从列标题中删除点号制表符会呈现行的值...

标签: mysql laravel tabulator


【解决方案1】:
Replace Period '.' with &#46;

看到这个jsfiddle你可以看到第一个项目,重复这个

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-14
    • 1970-01-01
    • 1970-01-01
    • 2020-05-01
    • 2013-12-13
    • 2022-12-02
    • 1970-01-01
    相关资源
    最近更新 更多