Table rendering error in layui, conflict with Thymeleaf syntax
table.render({
elem: '#fileList'
,url: 'testTable.json'
,page: true
,id: 'testReload'
,toolbar: '#toolbarDemo'
,cols: [[
{
type:'checkbox', fixed: 'left'}
,{
field: 'id', title: 'ID', sort: true,width:80}
,{
field: 'userId', title: '所属人',width:80, sort: true}
,{
field: 'name', title: '文件名',edit: 'text',width:160 }
,{
field: 'type', title: '类型',edit: 'text',width:80, sort: true}
,{
field: 'size', title: '大小(KB)',width:100, sort: true}
,{
field: 'gmtCreate', title: '上传时间',width:200, sort: true}
,{
fixed: 'right', title:'操作', toolbar: '#fun', width:160}
]]
});
Attention [[ ]]
In Thymeleaf is a grammar
If you want to use [[ ]] in js
The official document states that it is necessary to add th:inline="none" to the tag that references js
<script type="text/javascript" th:inline="none">
</script>
Add another better method, without grammatical conflicts
<script type="text/javascript">
[[]]
变为
[
[
]
]
</script>