此篇文章主要记录在使用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 Datagrid一些样式记录的更多相关文章

  1. 【easyui】关于easyui Datagrid一些样式记录

    此篇文章主要记录在使用datagrid中常见的修改样式方式以及样式效果配图!!!! 一丶存在选中框的时候标题栏合并显示序号字段. 代码展示: onLoadSuccess: function (data ...

  2. Easyui datagrid 实现表格记录拖拽

    datagrid 实现表格记录拖拽 by:授客 QQ:1033553122 测试环境 jquery-easyui-1.5.3 jquery-easyui-datagrid-dnd 下载地址: http ...

  3. EasyUI - DataGrid 组建 - [ 样式功能 ]

    效果显示: 同上次博文效果. html代码: 同上次博文代码. js代码: align: 'center',//标题和内容居中 resizable: false,//不允许改变大小 //hidden: ...

  4. 去掉easyui datagrid内部虚线的方式。

    去掉easyui        datagrid内部虚线的方式.easyui datagrid的样式是统一写在样式文件中的,如果想要统一替换可以找对应的datagird样式文件中的以下部分.如果想要改 ...

  5. easyui的datagrid的使用记录

    datagrid是在 table的基础上变化而来的, 而不是在div的基础上来的. 从div来变成 datagrid,样式的设置还是是比较麻烦的. dg=datagrid 的标题 来源于 column ...

  6. EasyUI datagrid 删除的时候无法正确找到重复记录row index的问题

    EasyUI datagrid 删除的时候无法正确找到重复记录row index的问题: 如果无法正确找到重复记录的row index,就需要进行注意添加的时候所进行的 操作:如果添加的时候就是添加的 ...

  7. 浅谈jQuery easyui datagrid操作单元格样式

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

  8. EasyUI datagrid优化

    easyui datagrid 在IE上加载速度慢, 150行数据就无法忍受了. firefox加载速度还可以. jquery easyui datagrid使用参考 http://www.cnblo ...

  9. 实现easyui datagrid在没有数据时显示相关提示内容

    本示例实现easyui datagrid加载/查询数据时,如果没有相关记录,则在datagrid中显示没有相关记录的提示信息,效果如下图所示 本实例要实现如下图所示的效果: 本示例easyui版本为1 ...

随机推荐

  1. Java四种引用类型

    纸上得来终觉浅,绝知此事要躬行  --陆游    问渠那得清如许,为有源头活水来  --朱熹 Java从1.2版本开始引入了4种引用,这四种引用的级别由高到低依次为:强引用>软引用>弱引用 ...

  2. 100个iOS开发面试题汇总

    100个iOS开发面试题汇总 关于iOS开发面试,不管对于招聘和应聘来说,面试都是很重要的一个环节,特别对于开发者来说,面试中的技术问题环节不仅是企业对应聘者技能和积累的考察,也是一个开发者自我检验的 ...

  3. 【翻译】EXTJS 编码风格指南与实例

    原文:EXTJS Code Style Guide with examples Ext JS风格指南: 熟知的且易于学习 快速开发,易于调试,轻松部署 组织良好.可扩展和可维护 Ext JS应用程序的 ...

  4. [转]Android长度单位详解

    android中定义的dimension单位有以下这些:px(Pixels ,像素):对应屏幕上的实际像素点.in(Inches ,英寸):屏幕物理长度单位.mm(Millimeters ,毫米):屏 ...

  5. gtk+程序在关闭主窗口时的事件流

    当鼠标单击gtk+窗口的关闭按钮时,程序首先接收到delete_event,当该事件处理函数返回TRUE表示事件已处理禁止进一步传播,从而取消关闭操作:当返回FALSE时,事件消息进一步向上传播,此时 ...

  6. C语言之选择排序

    选择法排序是相对好理解的排序算法.假设要对含有n个数的序列进行升序排列,算法步骤是: 1.从数组存放的n个数中找出最小数的下标(算法见下面的"求最值"),然后将最小数与第1个数交换 ...

  7. Android高级控件(四)——VideoView 实现引导页播放视频欢迎效果,超级简单却十分的炫酷

    Android高级控件(四)--VideoView 实现引导页播放视频欢迎效果,超级简单却十分的炫酷 是不是感觉QQ空间什么的每次新版本更新那炫炫的引导页就特别的激动,哈哈,其实他实现起来真的很简单很 ...

  8. Gradle 1.12用户指南翻译——第三十三章. PMD 插件

    本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...

  9. HBase Compaction

    当 client 向 hregion 端 put() 数据时, HRegion 会判断当前的 memstore 的大小是否大于参数hbase.hregion.memstore.flush.size 值 ...

  10. LeetCode(39)-Intersection of Two Linked Lists

    听歌曲初爱有感: 开头啰嗦两句,刚在做算法题目的时候,听到了杨宗纬的<初爱>,突然有了一种本科时候的感觉,想想自己现在研二了,青春喂了狗,我果断喝了一罐啤酒,循环这首歌到吐-.. 题目: ...