easyui-datagrid属性
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
列属性(Column Properties)
数据表格的列是一个对象数组,即这个对象中的元素也是一个数组(js中数组是对象)。
对象数组中的每一个元素都是可配置的对象,每个可配置对象定义一个列。
check box boolean 设置为true将显示复选框。
undefi
ned
forma tter functio
n
格式化单元格函数,有3个参数:
value:字段的值。
rowData:行数据。
rowIndex:行索引。
示例:
$('#dg').datagrid({
columns:[[
{field:'userId',title:'User',
width:80,
formatter:
function(value,row,index){
if (er){
return
;
} else {
return value;
}
}
}
]]
});
undefi
ned
styler functio
n
单元格样式函数,返回样式字符串装饰表格如'background:red',function有
3个参数:
value:字段值。
rowData:行数据。
rowIndex:行索引。
示例:
$('#dg').datagrid({
columns:[[
{field:'listprice',title:'List
Price', width:80, align:'right',
styler:
function(value,row,index){
if (value < 20){
return
'background-color:#ffee00;color:red;';
}
}
}
undefi
ned
]] });
sorter
functio
n
T 自定义字段排序函数,有2个参数: a :该列的第一个值。
b :该列的第二个值。
示例:
$('#dg').datagrid({
remoteSort: false, columns: [[
{field:'date',title:'Date',width:80,s ortable:true,align:'center',
sorter:function(a,b){ a = a.split('/'); b = b.split('/'); if (a[2] == b[2]){
if (a[0] == b[0]){ retur n (a[1]>b[1]?1:-1);
} else { retur n (a[0]>b[0]?1:-1);
} } else { return (a[2]>b[2]?1:-1);
} } } ]] });
undefi ned editor
string,o
bject
表明编辑类型。
如果属性是字符串类型表示编辑类型,如果是对象则包含2个参
数:
type :字符串,编辑类型,可选值:text ,textarea ,checkbox ,numberbox ,validatebox ,datebox ,combobox ,combotree 。
options :对象,对象于编辑类型的编辑器属性。
undefi ned
事件(Events )
事件继承控制面板,以下是数据表格独有的属性。