主框架页面: 在主界面区会加载西区菜单点击的URL内容.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <title>主界面</title> <div th:include="/public/util::public"/> <div th:include="/public/util::jquery-easyui"/> <script type="text/javascript" th:src="(${@configApp.getStaticWeb()})+'/cms/script/main/index.js'"></script> <script type="text/javascript" th:src="(${@configApp.getStaticWeb()})+'/cms/script/site/site-index.js'"></script> </head> <body class="easyui-layout"> <div data-options="region:'north',title:''" style="height:80px;" id="north"></div> <div data-options="region:'west',title:'系统功能区',split:true" style="200px;"> <ul class="easyui-tree" id="menu"></ul> </div> <div data-options="region:'center',title:'主界面区'" style="padding:5px;" id="center"></div> </body> </html>
此时在主页面已经加载了easy-ui的脚本和CSS ,在各区页面就不必加载了,即使加载了也会被去掉.
我一开始在datagrid页面添加格式化函数,但是没有效果,始终报找不到formatIsvalid这个函数.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <title>站点列表页面</title> <script type="text/javascript"> function formatIsvalid(val,row){ return val=='1'?'是':'否'; } </script> </head> <body> <table id="site" title="站点列表" class="easyui-datagrid" th:url="@{/site/list}" toolbar="#siteToolbar" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="siteid" width="50">ID</th> <th field="sitename" width="50">名称</th> <th field="siteurl" width="50">网址</th> <th field="isvalid" width="50" formatter="formatIsvalid">是否有效</th> <th field="isdelete" width="50">是否可以删除</th> <th field="remark" width="50">备注</th> <th field="createtime" width="50">创建时间</th> </tr> </thead> </table> <div id="siteToolbar"> <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newSite()">新增</a> <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editSite()">编辑</a> <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeSite()">删除</a> </div> </body> </html>
解决办法:把这个格式化函数放到主页面中就没有问题了.