jquery easyui如何实现格式化列
时间:2020-10-14 15:00:29|栏目:jquery|点击: 次
本文主要介绍了jquery easyui如何实现格式化列 ,正好最近需要用到,分享给大家,也给自己留个笔记
主框架页面: 在主界面区会加载西区菜单点击的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="width: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="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newSite()">新增</a> <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editSite()">编辑</a> <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="removeSite()">删除</a> </div> </body> </html>
解决办法:把这个格式化函数放到主页面中就没有问题了.
栏 目:jquery
本文地址:http://www.codeinn.net/misctech/11388.html