【easyui】关于easyui Datagrid一些样式记录
此篇文章主要记录在使用datagrid中常见的修改样式方式以及样式效果配图!!!!
一丶存在选中框的时候标题栏合并显示序号字段。
代码展示:
onLoadSuccess: function (data) {
//调整 按钮div与datagrid之间的3px间距
$('#j_contentButton').css('height', '43px');
//修改全选按钮
$(".datagrid-header-check").html("序号");
$(".datagrid-header-check").parent().prev().html("");
$(".datagrid-header-check").attr("style", "width:79px !important;font-weight: 700;height: 40px; line-height: 40px;font-size: 15px;")
},
效果图展示:

二丶不存在选中框的时候标题栏合并显示序号字段。
代码展示:
onLoadSuccess: function (data) {
//修改全选按钮
$(".datagrid-header-rownumber").html("序号");
$(".datagrid-header-rownumber").parent().next().html("");
},
效果图展示:

三丶左右布局时去除间隔空隙注意第5行 他才是关键其余只是为了展示效果
代码展示:
j_dgReceive = $("#j_dgReceive").datagrid({
iconCls: 'icon-save',
fit: true, // 自动适应父容器大小
fitColumns: false, //自动收缩列的大小
scrollbarSize: ,
rownumbers: true, //显示列号
nowrap: true, //如果为true,则在同一行中显示数据
animate: false,
border: false, //有边框
singleSelect: true,//多选
idField: 'id', //标识字段
pagination: true,//数据表格控件底部显示分页工具栏
pageSize: ,
pageList: [, , , , , , , ],
url: '/FeeManage_Areas/FeeStatistics/GetBJbyCondition',
queryParams: {
childId: childId,
},
效果图展示:

四丶实现单元格可编辑效果
代码展示:
{
title: '退费金额', field: 'refundMoney', align: 'center', width: , sortable: true,
editor: {
type: 'validatebox',
options: {
validType: 'checkDecN',
onBeforeValidate: function () {
$(this).attr('maxlength', );
$(this).on("keyup", function (event) {
var ary = this.value.match(/(\d+(\.\d{,})?)/);
this.value = ary == null ? '' : ary[];
});
}
}
},
},
效果图展示:

五丶合并单元格跨行款列标题布局
代码展示:
//活动列
columns: [[
{ title: '园区名称', field: 'parkName', rowspan: , align: 'center', width: , sortable: true, },
{ title: '姓名', field: 'childName', rowspan: , align: 'center', width: , sortable: true },
{ title: '年级', field: 'gradeNo', rowspan: , align: 'center', width: , sortable: true, },
{ title: '班级', field: 'classNo', rowspan: , align: 'center', width: , sortable: true, },
{ title: '保教费', colspan: , align: 'center', },
{ title: '学平险', colspan: , align: 'center', },
{ title: '餐费', colspan: , align: 'center', },
{ title: '休园管理费', colspan: , align: 'center', },
{ title: '押金', colspan: , align: 'center', },
{ title: '自定义费用', colspan: , align: 'center', },
{ title: '幼儿缴费总额', field: 'childTotalReceive', rowspan: , align: 'center', width: , sortable: true, },
{ title: '幼儿退费总额', field: 'childTotalRefund', rowspan: , align: 'center', width: , sortable: true, },
], [
//保教费
{ title: '缴费总额', field: 'bjfTotalReceive', align: 'center', width: , sortable: true, },
{ title: '退费总额', field: 'bjfTotalRefund', align: 'center', width: , sortable: true, },
//学平险
{ title: '缴费总额', field: 'xpxTotalReceive', align: 'center', width: , sortable: true, },
{ title: '退费总额', field: 'xpxTotalRefund', align: 'center', width: , sortable: true, },
//餐费
{ title: '缴费总额', field: 'cfTotalReceive', align: 'center', width: , sortable: true, },
{ title: '退费总额', field: 'cfTotalRefund', align: 'center', width: , sortable: true, },
//休园管理费
{ title: '缴费总额', field: 'xyglfTotalReceive', align: 'center', width: , sortable: true, },
{ title: '退费总额', field: 'xyglfTotalRefund', align: 'center', width: , sortable: true, },
//押金
{ title: '缴费总额', field: 'yjTotalReceive', align: 'center', width: , sortable: true, },
{ title: '退费总额', field: 'yjTotalRefund', align: 'center', width: , sortable: true, },
//自定义
{ title: '缴费总额', field: 'zdyTotalReceive', align: 'center', width: , sortable: true, },
{ title: '退费总额', field: 'zdyTotalRefund', align: 'center', width: , sortable: true, }, ]],
效果图展示:

六丶修改选中框样式
代码展示:
//冻结列
frozenColumns: [[
{
title: '', field: 'printFlag', align: 'center', sortable: true, width: ,
formatter: function (value, row, index) {
if (value == ) {
return "<span class='item-selected' onclick='specificUtil.CheckOrUnCheck(" + index + ",\"" + row.id + "\")'></span>";
} else {
return "<span class='item-unselected' onclick='specificUtil.CheckOrUnCheck(" + index + ",\"" + row.id + "\")'></span>";
}
},
},
{ title: '主键', field: 'id', sortable: true, align: 'center', width: , hidden: true, },
]], //3.选中或取消选中
CheckOrUnCheck: function (index, rowId) {
var rows = $("#j_dgExamine").datagrid("getRows");
if (initClick != undefined) {
var row = rows[index];
//提交数据
$.ajax({
type: 'POST',
url: '/Welfare_Areas/WelfareExamine/AccMark',
data: {
accId: rowId
},
dataType: 'json',
cache: false,
success: function (jsonData) {
myUitls.procAjaxMsg(jsonData, function () {
row.printFlag = row.printFlag == "" ? "" : "";
if (row.printFlag == "") {
$("#j_dgExamine").datagrid("updateRow", {
index: index,
row: row
})
$("#j_dgExamine").datagrid('beginEdit', index);
}
else {
$("#j_dgExamine").datagrid('endEdit', index);
$("#j_dgExamine").datagrid('cancelEdit', index);
} $(".datagrid-editable-input").attr("maxlength", )
}, function () {
myUitls.alertMsg(jsonData.Msg, '提示', null);
//取消确定按钮聚焦效果
myUitls.cancleFocus();
return;
});
}
});
}
},
样式代码:
/*有叉号样式*/
.item-selected {
width: 18px;
height: 18px;
float: right;
text-align: center;
background-image: url(../../../../images/area/Common/select_sel2.png);
cursor: pointer;
} /*无叉号样式*/
.item-unselected {
width: 18px;
height: 18px;
float: right;
text-align: center;
background-image: url(../../../../images/area/Common/select_nor2.png);
cursor: pointer;
}
onLoadSuccess: function (data) {
$(".datagrid-header-rownumber").html("序号");
$(".datagrid-header-rownumber").parent().next().css("display","none");
$(".datagrid-header-rownumber").attr("style", "width:65px !important;height:40px;line-height:40px;font-weight: 700;font-size: 14px;")
},
效果展示:

【easyui】关于easyui Datagrid一些样式记录的更多相关文章
- 关于easyui Datagrid一些样式记录
此篇文章主要记录在使用datagrid中常见的修改样式方式以及样式效果配图!!!! 一丶存在选中框的时候标题栏合并显示序号字段. 代码展示: onLoadSuccess: function (data ...
- easyui的datagrid的使用记录
datagrid是在 table的基础上变化而来的, 而不是在div的基础上来的. 从div来变成 datagrid,样式的设置还是是比较麻烦的. dg=datagrid 的标题 来源于 column ...
- Easyui datagrid 实现表格记录拖拽
datagrid 实现表格记录拖拽 by:授客 QQ:1033553122 测试环境 jquery-easyui-1.5.3 jquery-easyui-datagrid-dnd 下载地址: http ...
- [转]easyui常用控件及样式API中文收藏
[转]easyui常用控件及样式收藏 2013-05-06 23:01 30612人阅读 评论(0) 收藏 举报 分类: java ee(5) 目录(?)[+] CSS类定义: div easyu ...
- EasyUi控件Datagrid
很久没有打开我的博客园,刚刚大概扫了一眼我之前写的笔记,关于Devexpress那篇居然有四千多的浏览记录,不知道对浏览过的博友有没有起到一点点作用.当然我写笔记仅仅只是给自己留个记忆,如果歪打正着帮 ...
- jQuery EasyUI教程之datagrid应用(三)
今天继续之前的整理,上篇整理了datagrid的数据显示及其分页功能 获取数据库数据显示在datagrid中:jQuery EasyUI教程之datagrid应用(一) datagrid实现分页功能: ...
- jQuery EasyUI教程之datagrid应用(二)
上次写到了让数据库数据在网页datagrid显示,我们只是单纯的实现了显示,仔细看的话显示的信息并没有达到我们理想的效果,这里我们丰富一下: 上次显示的结果是这样的 点击查看上篇:jQuery Eas ...
- jQuery EasyUI教程之datagrid应用(一)
最近一段时间都在做人事系统的项目,主要用到了EasyUI,数据库操作,然后抽点时间整理一下EasyUI的内容. 这里我们就以一个简洁的电话簿软件为基础,具体地说一下datagrid应用吧 datagr ...
- easyUI中点击datagrid列标题排序
easyUI中点击datagrid的排序有两种,一种是本地的,一种是服务器的.本地的只能排序当前页,而服务器的可以对全部页进行排序.这里主要是分享下服务器排序. 1.为datagrid添加属性remo ...
随机推荐
- MFC为多个控件绑定同一个函数
方式一: afx_msg void OnButtonClick(UINT nID); ON_CONTROL_RANGE(BN_CLICKED, IDC_BUTTON_1, IDC_BUTTON_XX, ...
- FreeRTOS移植到STM32上的移植过程
所有的单片机都是顺序执行的,而对于多任务而言就显得力不从心了,虽然在一些小项目中可以通过定时器来实现,但这种实现方式没有实时性,一旦任务需要在规定时间内做出响应,那只能通过实时操作系统来完成了.在很多 ...
- Struts2 项目 Action 查询结果异常 org.apache.struts2.json.JSONException
问题描述 今天进行一个订单管理模块的开发时遇到一个问题:查询的订单时有时会报这个异常: org.apache.struts2.json.JSONException: java.lang.Illegal ...
- css插入背景图片底部有白边的解决方法
相信很多小伙伴遇到过用CSS插入背景图时,底部出现白边的情况,如下图: 个人总结了2个方法如下: 解决方法1:给图片都加上 vertical-align: middle属性.有时,移动端也会有类似 ...
- 剑指offer【02】- 替换空格(Java)
题目:替换空格 考点:字符串 题目描述: 请实现一个函数,将一个字符串中的每个空格替换成“%20”.例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy. ...
- Go并发编程之美-CAS操作
摘要: 一.前言 go语言类似Java JUC包也提供了一些列用于多线程之间进行同步的措施,比如低级的同步措施有 锁.CAS.原子变量操作类.相比Java来说go提供了独特的基于通道的同步措施.本节我 ...
- odoo开发笔记 -- 升级模块 提示外部ID找不到
可能的原因: 排查顺序: 1.id在视图中的加载顺序问题. 可能是:__manifest__.py文件,view文件先后加载顺序有问题:也可能是:xml 视图文件中,被引用的id出现在了引用id的下方 ...
- 服务端如何安全获取客户端请求IP地址
服务端如何获取客户端请求IP地址,网上代码一搜一大把.其中比较常见有x-forwarded-for.client-ip等请求头,及remote_addr参数,那么为什么会存在这么多获取方式,以及到底怎 ...
- Spring boot CommandLineRunner接口使用例子
前言 Spring boot的CommandLineRunner接口主要用于实现在应用初始化后,去执行一段代码块逻辑,这段初始化代码在整个应用生命周期内只会执行一次. 如何使用CommandLineR ...
- unity5.5 ugui使用美术字
文件转载自:http://www.jianshu.com/p/a4e6d1ca3ca0 项目需要使用美术字加强战斗效果表现,按以往NGUI的使用经验,这个应该很简单,随便Google一下都有数篇技术博 ...