EasyUI datagrid 格式化显示数据
http://blog.163.com/ppy2790@126/blog/static/103242241201512502532379/
value: the field value.
rowData: the row record data.
rowIndex: the row index.
{
title : '性别',
field : 'gender',
width : 50,
formatter:function(value,rec){
return rec.gender==0?'女':'男';
}
}
{
title : '回访日期',
field : 'date',
width : 120,
formatter: function (value, rec, index) {
if (value == undefined) {
return "";
}
/*json格式时间转js时间格式*/
var date = new Date(value);
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()+' '+date.getHours()+":"+date.getMinutes();
}
},
创建 DataGrid
- <table id="tt" title="Formatting Columns" class="easyui-datagrid" style="width:550px;height:250px"
- url="data/datagrid_data.json"
- singleSelect="true" iconCls="icon-save">
- <thead>
- <tr>
- <th field="itemid" width="80">Item ID</th>
- <th field="productid" width="80">Product ID</th>
- <th field="listprice" width="80" align="right" formatter="formatPrice">List Price</th>
- <th field="unitcost" width="80" align="right">Unit Cost</th>
- <th field="attr1" width="100">Attribute</th>
- <th field="status" width="60" align="center">Stauts</th>
- </tr>
- </thead>
- </table>
注意 'listprice'字段有一个 'formatter'属性这个指明格式化函数.
写格式化函数
- function formatPrice(val,row){
- if (val < 20){
- return '<span style="color:red;">('+val+')</span>';
- } else {
- return val;
- }
- }
EasyUI datagrid 格式化显示数据的更多相关文章
- EasyUI Datagrid 分页显示(客户端)
转自:https://blog.csdn.net/metal1/article/details/17536185 EasyUI Datagrid 分页显示(客户端) By ZYZ 在使用JQuery ...
- easyui datagrid 每条数据后添加操作按钮
easyui datagrid 每条数据后添加“编辑.查看.删除”按钮 1.给datagrid添加操作字段:字段值 <table class="easyui-datagrid" ...
- 实现easyui datagrid在没有数据时显示相关提示内容
本示例实现easyui datagrid加载/查询数据时,如果没有相关记录,则在datagrid中显示没有相关记录的提示信息,效果如下图所示 本实例要实现如下图所示的效果: 本示例easyui版本为1 ...
- 解决easyui datagrid加载数据时,checkbox列没有根据checkbox的值来确定是否选中
背景: 昨天帮朋友做一个easyui datagrid的小实例时,才发现easyui datagrid的checkbox列,没有根据值为true或false来选中checkbox,当时感觉太让人失 ...
- JS-easyui 扩展easyui.datagrid,添加数据loading遮罩效果代码
(function (){ $.extend($.fn.datagrid.methods, { //显示遮罩 loading: function(jq){ return jq.each(functio ...
- 扩展easyui.datagrid,添加数据loading遮罩效果代码 --来自网摘收集
//jquery.datagrid 扩展 (function (){ $.extend($.fn.datagrid.methods, { //显示遮罩 loading: function(jq){ r ...
- jQuery扩展easyui.datagrid,添加数据loading遮罩效果代码
//jquery.datagrid 扩展加载数据Loading效果 (function (){ $.extend($.fn.datagrid.methods, { //显示遮罩 loading: fu ...
- Easyui datagrid加载数据时默认全选的问题
问题描述: 最近使用 Easyui datagrid 展示数据,之前一直使用很正常,今天出现了一个怪异问题 加载数据后,只要点击选中列 ck 的任意行或多行,再刷新时整个datagrid的所有数据都 ...
- 在easyui datagrid中formatter数据后使用linkbutton
http://ntzrj513.blog.163.com/blog/static/2794561220139245411997/ formatter:function(value,rowData,ro ...
随机推荐
- 05Spring_Bean属性的集合类型的注入
- Verilog学习笔记基本语法篇(九)········ 任务和函数
task 和 function 说明语句分别用来定义任务和函数,利用任务和函数可以把函数模块分成许多小的任务和函数便于理解和调试.任务和函数往往还是大的程序模块在不同地点多次用到的相同的程序段.输入. ...
- [转]CodeSmith和PowerDesigner的使用安装和数据库创建
最近要忙期考,但还是决定每天抽点空来写CodeSmith的系列文章了,在此实在不敢用教程这个词语,毕竟自己对CodeSmith了解的也不是很多,有很多牛人都在博客园发布了不少关于CodeSmith的文 ...
- Caffe学习系列(9):运行caffe自带的两个简单例子
为了程序的简洁,在caffe中是不带练习数据的,因此需要自己去下载.但在caffe根目录下的data文件夹里,作者已经为我们编写好了下载数据的脚本文件,我们只需要联网,运行这些脚本文件就行了. 注意: ...
- [CareerCup] 11.4 Sort the File 文件排序
11.4 Imagine you have a 20 GB file with one string per line. Explain how you would sort the file. 这道 ...
- 详解SpringMVC中Controller的方法中参数的工作原理[附带源码分析]
目录 前言 现象 源码分析 HandlerMethodArgumentResolver与HandlerMethodReturnValueHandler接口介绍 HandlerMethodArgumen ...
- JS判断输入是否为整数和数字的正则表达式
"^\\d+$" //非负整数(正整数 + 0) "^[0-9]*[1-9][0-9]*$" //正整数 "^((-\\d+)|(0+))$" ...
- fis-receiver:一行命令将项目部署到远程服务器
前言 本项目基于FIS2,没了.其实fis项目本身就提供了php版本的范例,这里翻译成node版本. 项目地址:https://github.com/chyingp/fis-receiver 服务端接 ...
- Mac无法找到摄像头问题解决
facetime显示“未检测到摄像头”之类的,重启后可能摄像头有工作正常了,摄像头不稳定 重置 NVRAM后恢复正常,据说机器卡的时候,此法也可以使用. https://support.apple.c ...
- 备忘:SSRS技巧三则
前言 最近在弄SSRS,发现了三个小技巧.在此记录一下.免得以后忘了. 技巧 1. SSRS输出成EXCEL时,让两个dataset各占一个sheet, 这个简单,在其中一个table的属性加上pag ...