jQuery MiniUI

标题: 请教datagrid,cell设置样式,修改cell的validate [打印本页]

作者: caojun900828    时间: 2016-5-9 10:25:07     标题: 请教datagrid,cell设置样式,修改cell的validate

datagrid 的drawcell事件,
{    sender: Object,    rowIndex: Number,    columnIndex: Number,    record: Object,        column: Object,    field: String,    value: String,    cellHtml: "",    rowCls: "",    cellCls: "",    rowStyle: "",    cellStyle: ""}api是如上,1,我在修改单元格的样式,e.cellStyle="background-color:red",结果修改了整行的样式,请问如何才能修改本cell的样式?2,cell是可编辑的cell,将本列设置为validate为false,怎么设置?

作者: dforce    时间: 2016-5-9 12:27:05

1 e.cellStyle就是修改一个单元格的,你可以根据行+列来确定单元格
2 验证只能在验证事件oncellvalidation事件里处理
作者: dforce    时间: 2016-5-9 12:27:06

1 e.cellStyle就是修改一个单元格的,你可以根据行+列来确定单元格
2 验证只能在验证事件oncellvalidation事件里处理
作者: caojun900828    时间: 2016-5-9 14:29:54

dforce 发表于 2016-5-9 12:27
1 e.cellStyle就是修改一个单元格的,你可以根据行+列来确定单元格
2 验证只能在验证事件oncellvalidation ...

请问,如何通过“根据行+列来确定单元格”来确定,不知道代码怎么写?能有个提示吗?谢谢!
作者: dforce    时间: 2016-5-9 15:02:33

caojun900828 发表于 2016-5-9 14:29
请问,如何通过“根据行+列来确定单元格”来确定,不知道代码怎么写?能有个提示吗?谢谢! ...

ondrawcell事件里面有e.field这个可以确定列,e.record可以确定行
http://www.miniui.com/demo/#src=datagrid/drawcell.html
作者: caojun900828    时间: 2016-5-9 18:09:38

dforce 发表于 2016-5-9 15:02
ondrawcell事件里面有e.field这个可以确定列,e.record可以确定行
http://www.miniui.com/demo/#src=data ...

感谢!,我改成这样,就能达到效果了
在drawcell事件里面,
if(“modified”==e.record_state && "attrValue" == e.field){
    e.cellStyle="background-color:red";
}




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2