一:火狐浏览器不显示时间,但是chrome显示。
今天同事遇到这个问题,我找了很久,通过store 的load监听,发现火狐上面的create时间居然为null,后来才发现他的model中,
{name:'created',type:'date‘,dateFormat: 'd/m/Y'},
我将date改成string,就可以显示了,但是订单那里也是不行,后来再查,发现他的xtype写错了,
{header:'创建时间',dataIndex :'created',width:200,align: 'center'/*editor:{xtype:'datefield',allowBlank:true},xtype:'datecolumn',*/},
后面写成了datecolumn,注掉就出来了。
2.grid中多个对象。
{
header:'标签',
dataIndex :'tags',
width:150,
align: 'center',
renderer: function(value, metaData, record, row, col, store, gridView){
if(value!=null){
var newValues=new Array();
for(var i=0;i<value.length;i++){
newValues.push(value[i].userTag.name);
}
var newValue=newValues.join(',');
return newValue
}
return '';
}
},
json数据:
,"username":"admin","fullName":"admin","email":"admin","phone":"38483801","enabled":true,"created":"2013-08-05 17:45:26","tags":[{"id":1,"userTag":{"id":9,"name":"闀胯窇","parent":{"id":3,"name":"鐢板緞","parent":{"id":1,"name":"浣撹偛","parent":null}}}},{"id":2,"userTag":{"id":5,"name":"缃戠悆","parent":{"id":4,"name":"鐞冪被","parent":{"id":1,"name":"浣撹偛","parent":null}}}}]}]
3.给grid columns加上提示:
{
header:'标签',
dataIndex :'tags',
width:150,
align: 'center',
renderer: function(value, metaData, record, row, col, store, gridView){
if(value!=null){
var newValues=new Array();
for(var i=0;i<value.length;i++){
newValues.push(value[i].userTag.name);
}
var newValue=newValues.join(',');
if(newValue.length>10){
metaData.tdAttr = 'data-qtip="'+newValue+'"';
newValue = newValue.substring(0,10)+"...";
}
return newValue
}
return '';
}
},
效果图: