我有一个从过程创建的临时表。我将其分配给变量,然后将其转换为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列(从左到右计数)没有任何值。
答案 0 :(得分:1)
Replace Period '.' with .
看到此jsfiddle,您可以看到第一项,重复此
.\u0411\u0438\u0448\u043a\u0435\u043a":12,