属性(继承datagrid)
属性名 |
类型 |
含义 |
showGroup |
boolean |
是否显示属性分组 |
groupField |
string |
分组的字段名 |
groupFormatter |
function(group,rows) |
如何格式化分组的值。该函数拥有如下参数:group:分组字段值。rows:属于该分组的所有行。 |
方法
方法名 |
参数 |
含义 |
expandGroup |
groupIndex |
展开指定分组,没有参数,则展开全部 |
collapseGroup |
groupIndex |
折叠指定分组,没有参数,则折叠全部 |
我的demo
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>dataGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
<script type="text/javascript">
$(function(){
var data = [
{"name":"Name","value":"Bill Smith","group":"ID Settings","editor":"text"},
{"name":"Address","value":"","group":"ID Settings","editor":"text"},
{"name":"SSN","value":"123-456-7890","group":"ID Settings","editor":"text"},
{"name":"Email","value":"bill@gmail.com","group":"Marketing Settings","editor":{
"type":"validatebox",
"options":{
"validType":"email"
}
}}
];
$('#pg').propertygrid({
data: data,
showGroup: true,
scrollbarSize: 0,
});
$('#pg').propertygrid('collapseGroup');
var row = {
name:'AddName',
value:'',
group:'Marketing Settings',
editor:'text'
};
$('#pg').propertygrid('appendRow',row);
})
</script>
<body >
<table id="pg" style="width:300px"></></table>
</body>
</head>
</html>