問題來源
今天用SpringBoot中的Thymeleaf查詢資料庫中資料并進行分頁,為了友善使用了easyui的datagrid,并通過腳本建立資料網格,但是一直報一個錯誤:無法解析datagrid的腳本語言。經過查詢資料,解決方案如下:
原腳本如下:
<link rel="stylesheet" type="text/css" href="/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/easyui/demo.css">
<script type="text/javascript" src="/easyui/jquery.min.js"></script>
<script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
<script>
$(function(){
$(function(){
$('#usershow').datagrid({
url: 'user',
rownumbers:true,
pagination:true,
pageSize:2,
pageList:[2,4],
columns: [[
{field: 'uname', title: '使用者名', width: 200,align:'center'},
{field: 'pwd',title: '密碼',width: 200,align:'center'},
{field: 'phone', title: '手機号', width: 200,align:'center'}
]]
});
});
});
</script>
問題如下:
There was an unexpected error (type=Internal Server Error, status=500).
Could not parse as expression:
" {field: 'uname', title: '使用者名', width: 200,align:'center'}, {field: 'pwd',title: '密碼',width: 200,align:'center'}, {field: 'phone', title: '手機号', width: 200,align:'center'} " (template: "page" - line 20, col 32)
問題解決:
在中加一個th:inline="none"就可以解決了
