今天项目上遇到问题,就是表格风格统一的问题,由于用了2个不同的框架,所以如果要大修比较麻烦,考虑到修改表格样式工作量会少很多,所以考虑修改jQuery easyui datagrid数据网格的样式。

  对于这种问题,我们应该也经常遇到。其实利用jQuery的强大选择器,要操作到每个单元格都很容易,所以解决这个问题的思路也很简单,在数据加载完以后(这时候内容单元格才形成),我们查找具体的列或者单元格,然后定义每个单元格的样式,所以定义一下各属性和onLoadSuccess事件就可以了:

function showResultInfo(obj){
$.messager.show({
title:'详细信息',
msg:'<form id="info_from" method="post" target="info_from"></form><div><table id="infoElement_table"></table></div>',
showType:'fade',
showSpeed:,
width:,
height:,
timeout:,
style:{
right:'',
bottom:''
}
});
$("#infoElement_table").datagrid({
striped : true,
width : ,
height : ,
toolbar: ["-",{
iconCls: 'icon-redo',
text: '导出结果',
handler: function(){
$("#info_from").attr("action",'user/userAction_exportResult.do');
$("#info_from").submit();
}
},"-"],
collapsible : true,
autoRowHeight : false,
columns : [ [
{
field : 'name',
title : '姓名',
align : 'center',
width :
},{
field : 'org',
title : '组织机构',
align : 'center',
width :
},
{
field : 'msg',
title : '信息',
align : 'center',
width :
}
] ],
pagination : false,
rownumbers : true,
fitColumns : false,
onHeaderContextMenu : function(e, field) {
headerContextMenu(e, field);
},
onLoadSuccess: function(){
$(".datagrid-view td").css("border","0px");
$(".datagrid-view2 td").css("border-left","1px dashed #ccc");
$(".datagrid-view1").find("tr:last").css("border-bottom","1px solid #ccc");
$(".datagrid-view2").find("tr:last").css("border-bottom","1px solid #ccc");
$(".datagrid-toolbar a").css({"background":"#02665a","color":"#fff"});
$(".messager-body").css({"border":"0px","padding":"0px"});
}
}); $("#infoElement_table").datagrid("loadData",obj);
}

  onLoadSuccess事件里面我们操作了各元素的样式,能找到具体元素,所有问题也就迎刃而解了,我们甚至可以做出跟精细的排版。

浅谈jQuery easyui datagrid操作单元格样式的更多相关文章

  1. [转]浅谈jQuery EasyUI的属性设置

    原文地址:http://www.easyui.info/archives/1664.html 对jQuery EasyUI有一定了解的话,应该知道基本上每一个组件都有一个"options&q ...

  2. jquery easyui datagrid设置行样式 不可删除某行

    rowStyler: function (index,row) { if (parseInt(row.ksrs) > 0) { return 'color:red'; } }, onLoadSu ...

  3. 扩展jquery easyui datagrid编辑单元格

    扩展jquery easyui datagrid编辑单元格 1.随便聊聊 这段时间由于工作上的业务需求,对jquery easyui比较感兴趣,根据比较浅薄的js知识,对jquery easyui中的 ...

  4. jquery easyui datagrid使用参考

    jquery easyui datagrid使用参考   创建datagrid 在页面上添加一个div或table标签,然后用jquery获取这个标签,并初始化一个datagrid.代码如下: 页面上 ...

  5. 扩充 jQuery EasyUI Datagrid 数据行鼠标悬停/离开事件(onMouseOver/onMouseOut)

    客户需求: jQuery EasyUI Datagrid 用户列表鼠标悬停/离开数据行时显示人员头像(onMouseOver/onMouseOut) 如图所示,Datagrid 鼠标悬停/离开数据行时 ...

  6. 扩展 jQuery EasyUI Datagrid 数据行鼠标悬停/离开事件(onMouseOver/onMouseOut)

    客户需求: jQuery EasyUI Datagrid 用户列表鼠标悬停/离开数据行时显示人员头像(onMouseOver/onMouseOut) 如图所示,Datagrid 鼠标悬停/离开数据行时 ...

  7. JQuery easyUi datagrid 中 自定义editor作为列表操作按钮列

    转自   http://blog.csdn.net/tianlincao/article/details/7494467 前言 JQuery easyUi datagrid 中 使用datagrid生 ...

  8. jQuery EasyUI datagrid实现本地分页的方法

    http://www.codeweblog.com/jquery-easyui-datagrid%e5%ae%9e%e7%8e%b0%e6%9c%ac%e5%9c%b0%e5%88%86%e9%a1% ...

  9. jQuery EasyUI DataGrid Checkbox 数据设定与取值

    纯粹做个记录,以免日后忘记该怎么设定. 这一篇将会说明两种使用 jQuery EasyUI DataGrid 的 Checkbox 设定方式,以及在既有数据下将 checked 为 true 的该笔数 ...

随机推荐

  1. Android与GPL、BSD和Apache之间的关系

    参考资料 Android ,在争议中逃离 Linux 内核的 GPL 约束 | 爱范儿 简介 众所周知,Linux内核基于GPL v2发行.GPL规定,基于GPL的软件产品的衍生产品,也必须使用GPL ...

  2. Java反射机制demo(三)—获取类中的构造函数

    Java反射机制demo(三)—获取类中的构造函数 1,获取类中所有的构造函数 如下面的代码中所示,这个类中显式的构造函数有五个. 空构造: public UserInfo() 带参构造有四个: pu ...

  3. 理解Linux的进程,线程,PID,LWP,TID,TGID

    在Linux的top和ps命令中,默认看到最多的是pid (process ID),也许你也能看到lwp (thread ID)和tgid (thread group ID for the threa ...

  4. 在ASP.NET Core 2.x中获取客户端IP地址

    一.前言 大家也知道服务端请求时我们获取的IP地址是包含在请求头中,因此这也大大便利了IP的获取. 在ASP.NET中,可以通过以下方式获取客户端的IP地址. HttpContext.Current. ...

  5. Oracle 判断为空 all space

    You can use trim on the column. where trim(product_type) is null The above is not DBMS-independent, ...

  6. 排序算法之快速排序Java实现

    排序算法之快速排序 舞蹈演示排序: 冒泡排序: http://t.cn/hrf58M 希尔排序:http://t.cn/hrosvb  选择排序:http://t.cn/hros6e  插入排序:ht ...

  7. luoguP4360 [CEOI2004]锯木厂选址

    题目链接 luoguP4360 [CEOI2004]锯木厂选址 题解 dis:后缀和 sum:前缀和 补集转化,减去少走的,得到转移方程 dp[i] = min(tot - sumj * disj - ...

  8. 20162318 2018-2019-2《网络对抗技术》Exp1 PC平台逆向破解

    一.实验目标 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数会简单回显任何用户输入的字符串. 该程序同时包含另一个代码片段,getS ...

  9. hdu 3864 素数分解

    题意:求n是否只有4个因子,如果是就输出除1外的所有因子. 模板题,就不排版了 #include<cstdio> #include<iostream> #include< ...

  10. PYQT窗口居中

    #UI.py,通过UI设计师制作后直接转换为UI.py脚本 # -*- coding: utf-8 -*-from PyQt4 import QtCore, QtGui try:    _fromUt ...