87,989
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/bootstrap.js"></script>
<style type="text/css">
.x-grid-background-red {
color : #FF0000;
}
</style>
<script type="text/javascript">
Ext.onReady(function(){
var data = [
['Anne', '22'],
['Bob', '18']
];
var store = Ext.create('Ext.data.ArrayStore', {
fields : ['name', 'age'],
data : data
});
var grid = Ext.create('Ext.grid.Panel', {
store : store,
columns : [{
text : 'Name',
dataIndex : 'name'
},{
text : 'Age',
dataIndex : 'age'
}],
height : 300,
width : 200,
renderTo : Ext.getBody(),
title : 'Grid Color Test',
viewConfig : {
getRowClass : function(record, rowIndex, rowParams, store){
var val = record.data.age - 0;
if(val > 20)
return 'x-grid-background-red';
else
return '';
}
}
});
});
</script>
</head>
<body>
</body>
</html>
function changeAge(val){
if (val > 20) {
return '<span style="color:red;">' + val + '</span>';
}
return val;
}