【发布时间】:2021-09-18 08:30:42
【问题描述】:
我试图使用 DataTables 插件来进行数据可视化工作。从网站上我们可以看到结果:
这里是链接:https://datatables.net/examples/basic_init/data_rendering.html
我也想让它在我的 Laravel 项目中运行,这是我的结果:
但什么也没发生。我想也许数据源不同?
这是我的看法:
<table id="statisticforstudent" class="table-responsive" style="width:100%">
<thead>
<th>Kapitel</th>
<th>RichtigeRate</th>
</thead>
<tbody>
@foreach($statistic_students as $value)
<tr>
<td>{{$value -> chapters_id}}</td>
<td>{{$value -> correct_rate_stu}}</td>
</tr>
@endforeach
</tbody>
</table>
还有我的 JavaScript:
<script>
$(document).ready( function () {
$('#statisticforstudent').DataTable({
"paging": true,
"ordering": false,
"info": false,
"bLengthChange": false,
//"iDisplayLength" : 10,
//lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
//"scrollY": "200px",
//"scrollCollapse": true,
// "paging": false
//"pagingType": "full_numbers",
select: false,
searching : false,
columns: [
{
data: 'correct_rate_stu',
render: function(data, type, row, meta) {
return type === 'display' ?
'<RichtigeRate="' + data + '" max="1"></RichtigeRate>' :
data;
}
]
},
});
});
</script>
有人知道吗?或者有没有更好的可视化插件?
【问题讨论】:
-
请提供将出现在行中的样本或示例数据。
-
您的代码似乎使用了名为
<RichtigeRate>的东西 - 但它应该使用 HTML<progress>元素 - 请参阅 here。
标签: jquery laravel datatables