EasyUI 中 DataGrid 控件 列 如何绑定对象中的属性
EasyUI 中 DataGrid 控件 是我们经常用到的控件之一,
但是 DataGrid 控件 在绑定显示列时却不支持对象属性绑定。
模型如下:
- public class Manager implements java.io.Serializable {
- private Integer id;
- private Role role;
- private String loginName;
- private String password;
- private int status;
- private Date lastDate;
- private Date createAt;
- private String remarks;
- //省略 get and set
- }
其中Role 是一个对象
- <table id="manager_datagrid">
- <thead>
- <tr>
- <th data-options="field:'loginName'">帐号</th>
- <th data-options="field:'role',formatter:managerRoleFormat">所属岗位</th>
- <th data-options="field:'createAt'">创建时间</th>
- <th data-options="field:'lastDate'">最后登录时间</th>
- <th data-options="field:'status',formatter:managerStatusFormat">状态</th>
- <th data-options="field:'remarks'">备注</th>
- </tr>
- </thead>
- </table>
- function managerRoleFormat(val,row){
- if(val) return val.roleName;
- else return "";
- }
- function managerStatusFormat(val,row){
- switch(val){
- case 0: return '停用';
- case 1: return '正常';
- default: return '';
- }
- }
这样通过 EasyUI 给我们提供的 formatter 函数 我们就可以实现 对象属性的绑定.
EasyUI 中 DataGrid 控件 列 如何绑定对象中的属性的更多相关文章
- EasyUI:datagrid控件简介
EasyUI:datagrid控件简介 1,水平滚动条属性: //显示滚动条 fitColumns:false //不显示滚动条 fitColumns:true
- WPF中自定义的DataTemplate中的控件,在Window_Loaded事件中加载机制初探
原文:WPF中自定义的DataTemplate中的控件,在Window_Loaded事件中加载机制初探 最近因为项目需要,开始学习如何使用WPF开发桌面程序.使用WPF一段时间之后,感 ...
- EasyUI中datagrid控件的使用 设置多行表头(两行或多行)
EasyUI中的datagrid控件十分强大,能生成各种复杂的报表,现在因为项目需要,需要生成一个表头两行的表,找了一些说明文档,以下用一个实例来说明一下: 第一种方法: $('#divData'). ...
- easyUI的datagrid控件日期列不能正确显示Json格式数据的解决方案
EasyUI是一套比较轻巧易用的Jquery控件,在使用过程中遇到一个问题,它的列表控件——datagrid, 在显示日期列的时候,由于后台返回给页面的数据是Json格式的,其中的日期字段,在后台是正 ...
- WPF中DataGrid控件内Button的Command和CommandParameter的绑定
场景:视频上传功能,上传列表使用DataGrid控件,视频有不同的状态对应不同的操作,DataGrid中最后一列为操作列,里面是Button控件.希望点击Button后执行对应的操作,但是设置Butt ...
- easyUI的datagrid控件日期列格式化
转自:https://blog.csdn.net/idoiknow/article/details/8136093 EasyUI是一套比较轻巧易用的Jquery控件,在使用过程中遇到一个问题,它的列表 ...
- 关于EasyUI中DataGrid控件的一些使用方法总结
一,DataGrid 控件的工作流程 1,通过JavaScript将一个空白的div美化成一个空白的Datagrid模板 2,Datagrid模板通过制定的Url发送请求,获取数据 ...
- winform中DataGrid控件的宽度设置
最近修改一个win5.0的PDA程式,碰到一个问题.就是给DataGrid控件绑定数据的时候,这个控件的宽度不能调整,有时候数据较长,就显示不全.然后想在程式里自定义它的宽度,设置不成功.然后网上没找 ...
- WPF中DataGrid控件的过滤(Filter)性能分析及优化
DataGrid控件是一个列表控件, 可以进行过滤,排序等.本文主要针对DataGrid的过滤功能进行分析, 并提供优化方案. 1)DataGrid的过滤过程: 用户输入过滤条件 ...
随机推荐
- C#中隐藏(new)、方法重写(override)、重载(overload)的区别
转自:http://www.cnblogs.com/glife/archive/2009/12/28/1633947.html 重载.重写和隐藏的定义: 重载:public string ToStri ...
- JS中this的值到底为何?
之前很久的时间,因为研究不深,对于this的值一直模模糊糊,不是很清楚,最近有空做了一些研究,终于彻底弄明白了this到底为何物. 首先, 先抛出一个定论:”在Javascript中,this关键字永 ...
- Nginx Debug Log
//检查nginx.conf时(sudo ./nginx -t),输出数据到检测结果 //ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "配置解析处理&q ...
- mysql max_allowed_packet
系统linux > show global max_allowed_packet; >set global max_allowed_packet=1024*1024: 退出mysql,重启 ...
- C++ 虚函数,纯虚函数的一些问题
#include <iostream> using namespace std; #define cendl cout << endl; class AA{//这是一个纯虚函数 ...
- js之路
开始记录js学习: udacity,edx上不去: 搞了一个html+css+JavaScript后开始看es6; 犀牛书,js启示录,你不知道的js上中: 第一个库jQuery及源码分析: --
- 【转】oracle in和exists、not in和not exists原理和性能探究
转自http://www.2cto.com/database/201310/251176.html 对于in和exists.not in和not exists还是有很多的人有疑惑,更有甚者禁用not ...
- Log4j的简要概述
读取配置文件的三种使用方式: 1.Java代码:BasicConfigurator.configure() 2.Java特性:键值对解析(properties文件) PropertyConfigura ...
- 在Android Studio中使用lambda表达式
build.gradle中添加以下配置 Android{ ..... compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targ ...
- create dll project based on the existing project
Today, I have to create a dll project(called my.sln), the dllmain.cpp/.h/ is already in another proj ...