1.grid表单单列有需要把后台数据换成指定形式数据(比如性别,后台是0男 1女 前台要显示男女而不是01)
需要用的renderer
renderer: function(value){
if (value===0) {
return '男';
}
return '女' ;
}
2.grid表单单列需要把后台传回过来的datetime类型显示出来,数据库(sqlserver08 )datetime类型和java对应timestamp,返回的会是这种格式的数据
Extjs显示是有问题的,需要转换一下
function setAddTime(record) {
/* var jsondate = record.data.weeks_Begin; */
var taday = new Date(record.time);
return taday.toLocaleString();
/*
* return eval("new " + jsondate.substr(1, jsondate.length -
* 2)).toLocaleDateString();
*/
}
3,grid表单单列触发单击事件,打开指定位置的文件(例子是图片)
header:'查看签到照片',
dataIndex:'inpic',
xtype : 'actioncolumn',
items : [{
icon : '../images/look.png',
tooltip : '查看照片',
handler : lookpicin
}]
var openpic;
function lookpicin(grid, rowIndex, colIndex)
{
var rec = grid.getStore().getAt(rowIndex);
var inpic=rec.get('inpic');
if(inpic==='N')
{
Ext.Msg.alert('提示','无照片');
}
else
{
if(openpic)
{
openpic.setVisible();
}
else
{
openpic=new Ext.window.Window({
title:'查看照片',
listeners : {
beforedestroy : function(cmp) {
this.hide();
return false;
}
},
items:[{
xtype : 'box', // 或者xtype: 'component',
/*id : 'pic', */
width : 450, // 图片宽度
height : 400, // 图片高度
autoEl : {
tag : 'img', // 指定为img标签
src : /RegisteMG/+inpic // 指定url路径
}
}],
bbar:[{xtype : 'tbfill'},{text:'确定',
handler:function(){
openpic.hide();
}}]
})
}
openpic.setVisible(true);
}
};