博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jQuery EasyUI使用教程之根据条件更换数据网格行背景颜色
阅读量:6985 次
发布时间:2019-06-27

本文共 956 字,大约阅读时间需要 3 分钟。

hot3.png

<>

本教程将为大家介绍在某些条件下如何更改数据网格组件的行样式。当listprice值大于50时,我们将为该行设置不同的颜色。

在数据网格的页脚中显示摘要信息

数据网格的rowStyler函数允许您可以自定义行样式,下面的代码演示了如何更改行样式:

<
table
id
=
"tt"
title
=
"DataGrid"
style
=
"width:600px;height:250px"
url
=
"data/datagrid_data.json"
singleselect
=
"true"
fitcolumns
=
"true"
>
<
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"
>List Price</
th
>
<
th
field
=
"unitcost"
width
=
"80"
align
=
"right"
>Unit Cost</
th
>
<
th
field
=
"attr1"
width
=
"150"
>Attribute</
th
>
<
th
field
=
"status"
width
=
"60"
align
=
"center"
>Stauts</
th
>
</
tr
>
</
thead
>
</
table
>
$(
'#tt'
).datagrid({
rowStyler:
function
(index,row){
if
(row.listprice>50){
return
'background-color:pink;color:blue;font-weight:bold;'
;
}
}
});

正如您所看到的,我们根据一些条件设置background-color为pink(粉红色),设置文本颜色为blue(蓝色)。

下载EasyUI示例:

有兴趣的朋友可以

转载于:https://my.oschina.net/u/2317468/blog/654024

你可能感兴趣的文章
xmlUtil 解析 创建
查看>>
我的友情链接
查看>>
linux 命令(3)echo
查看>>
Nginx基础入门之nginx基础配置项介绍(2)
查看>>
一次详细全面的***报告
查看>>
c# 三种异步编程模型EAP(*)、 APM(*)和 TPL
查看>>
deepin-安装问题:unable to find a medium containing a live file
查看>>
用 Hasor 谈一谈MVC设计模式
查看>>
IE 条件注释
查看>>
Windows热键注册(反汇编方法 查看win32api 原理)
查看>>
UNREFERENCED_PARAMETER的作用
查看>>
PHP计算表达式-栈
查看>>
IBATIS中关于iterate"$"与"#"的应用
查看>>
为什么要将对象序列化
查看>>
新增网址/网页 截图api[增加安全防护本接口已停用]源码可下载
查看>>
SpringMVC+Hibernate +MySql+ EasyUI实现POI导出Excel(二)
查看>>
刷leetcode第705题- 设计哈希集合
查看>>
dubbo协议参考
查看>>
SpringAOP拦截Controller,Service实现日志管理(自定义注解的方式)
查看>>
读《白帽子讲Web安全》之安全意识篇(一)
查看>>