jquery easyui如何实现格式化列
本文主要介绍了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>
解决办法:把这个格式化函数放到主页面中就没有问题了.
相关推荐
annan 2020-07-18
举 2020-06-27
harddays 2020-06-21
长安长夜Saint 2020-06-14
Magicsoftware 2020-06-04
soyo 2020-05-28
haocxy 2020-05-28
davidliu00 2020-05-26
coolhty 2020-05-20
niehanmin 2020-05-19
无缘公子 2020-05-19
fansenjun 2020-03-01
zmosquito 2020-05-10
玫瑰小妖 2020-05-10
jianghero 2020-05-05
jocleyn 2020-05-03
angqiuli 2020-04-26
waterv 2020-04-26
wcqwcq 2020-04-22