ext的Ext.data.JsonStore不自动获取数据的问题记录
来源:互联网 发布:mac uml建模工具 编辑:程序博客网 时间:2024/05/15 01:10
昨天在一个项目当中发现ext的JsonStore在IE的某些状况下并不能够自动从后台的Action获取json数据,问题原因到现在也没有查清楚。在本机的开发环境下对外发布服务一切正常,但是部署到公司的单元测试环境后,还是有些主机通过IE无法访问(用其他的浏览器比如火狐很正常)。
这里需要记录的就是问题的部分解决,原来通过本机设置JsonStore的autoLoad为true的时候,对外发布会一部分主机IE访问不正常,而改成了手动load数据,那么通过自己的开发环境对外发布服务一切正常。
typeStore =new Ext.data.JsonStore({
autoLoad:true,
url: root+'/issueType.do?method=getTypeList',
root: 'data',
fields:['typeId','typeName','typeDesc','displayOrder']
});
这是原来设置的一个JsonStore ,设置的属性autoLoad:true 让这个页面被加载的时候,自动地通过url为root+'/issueType.do?method=getTypeList' 来从后台的Action加载数据,通过解析json数据来绘制前台。也就是这个设定在一部分IE浏览器下不能够正常实现。
具体解决的方法是不使用自动加载,设置为下面的方法
typeStore =new Ext.data.JsonStore({
autoLoad:false,
url: root+'/issueType.do?method=getTypeList',
root: 'data',
fields:['typeId','typeName','typeDesc','displayOrder']
});
然后手动的拉数据来自于另外地方调用typeStore.load();将全部的init函数贴出来
function to_init(){
Ext.QuickTips.init();
typeRecord = Ext.data.Record.create([
{name: "typeId", type: 'string'},
{name: "typeName", type:'string'},
{name: "typeDesc", type:'string'},
{name: "displayOrder", type:'string'}
]);
typeStore =new Ext.data.JsonStore({
autoLoad:false,
url: root+'/issueType.do?method=getTypeList',
root: 'data',
fields:['typeId','typeName','typeDesc','displayOrder']
});
//alert(typeStore.+"-----------");
var colModel = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{
header: "问题类型名称",
dataIndex:'typeName',
width: 300,
sortable: true,
renderer:"htmlEncode",
editor:new Ext.form.TextField({
allowBlank:false
})
}, {
header: "问题类型描述",
dataIndex:'typeDesc',
width: 400,
sortable: true,
renderer:"htmlEncode",
editor:new Ext.form.TextField({
})
}, {
header: "显示顺序",
dataIndex:'displayOrder',
width: 100,
sortable: true,
editor:new Ext.form.NumberField({
allowBlank:false,
allowDecimals:false,
allowNegative:false,
style:'text-align:left;'
})
},
{ header: "删除",dataIndex:'typeName', width: 80, sortable: false,renderer:showDeleteUrl}
]);
typeGrid = new Ext.grid.EditorGridPanel({
id:'typeGrid',
title:'问题类型管理',
loadMask: {msg:'<bean:message bundle="common" key="js.message.loading"/>'},
trackMouseOver:true,
stripeRows:true,
frame:true,
clicksToEdit: 1,
store: typeStore,
cm:colModel,
iconCls:'icon_grid',
listeners:{//listeners
afteredit:function(e){//if-5
if(e.column==3){//if-4
if(!(e.record.get('displayOrder')!='0'&&e.record.get('displayOrder')=='')){//if-3
for(var i=0;i<typeStore.getCount();i++){//for-1
var rec=typeStore.getAt(i);
if(!(rec.get('displayOrder')!='0'&&rec.get('displayOrder')=='')){//if-2
//if-1
if(e.row!=i&&e.record.get('displayOrder')==rec.get('displayOrder')){
Ext.Msg.alert('<bean:message bundle="common" key="js.message.systemInfo"/>','与第【'+(i+1)+'】行显示顺序重复!');
if(e.column==3 ){
e.record.set('displayOrder','');
}
break;
}//if-1
}//if-2
}//for-1
}//if-3
}//if-4
}//if-5
},
//listeners
tbar:[{
text:'<bean:message bundle="common" key="btn.add"/>',
iconCls:'icon_add',
handler:function(){
var myNewRecord = new typeRecord({
typeId: '',
typeName: '',
typeDesc:'',
displayOrder:''
});
typeStore.add(myNewRecord);
}
}]
});
mainPanel = new Ext.Panel({
layout:'border',
frame:true,
buttons:[
{
text:'<bean:message bundle="common" key="btn.save"/>',
handler:function(){
toSave();
}
},
{
text:'<bean:message bundle="common" key="btn.reset"/>',
handler:function(){
Ext.getCmp('typeGrid').getStore().reload();
}
}
],
buttonAlign:'center',
items:[{
region:'center',
layout:'fit',
autoScroll:true,
items:typeGrid
}]
});
viewport = new Ext.Viewport({
layout:'fit',
id:'viewport',
items:mainPanel
});
typeStore.load();
};
- ext的Ext.data.JsonStore不自动获取数据的问题记录
- Ext.data.JsonStore的用法
- 关于extj4的Ext.data.JsonStore的问题
- EXT的jsonstore使用
- 【读】Ext.data.JsonStore
- 浅谈:Ext.data.JsonStore
- Ext.data.JsonStore使用HttpProxy加载数据时传递参数的两种方法
- Ext.data-GroupingStore/JsonStore/SimpleStore
- Ext.data-GroupingStore/JsonStore/SimpleStore
- Ext.data-GroupingStore/ JsonStore/ SimpleStore
- Ext.data-GroupingStore/ JsonStore/ SimpleStore
- Ext.data-GroupingStore/JsonStore/SimpleStore
- 理解Ext.data.JsonStore 对象
- Ext.data-GroupingStore/JsonStore/SimpleStore
- Ext Jsonstore中文字段的实现
- ext中ArrayStore,JsonStore,XmlStore的用法
- ext中ArrayStore,JsonStore,XmlStore的用
- EXT 的Ext.data.DWRProxy
- 【Vegas2009】4月24日-Boots Randolph,我总算找到你了!
- 【Vegas2009】4月24日-下周一结婚喽!
- 【Vegas2009】4月24日-下周一结婚喽!
- 【Vegas2009】5月6日-婚纱照出炉咯!
- 【Vegas2009】5月6日-婚纱照出炉咯!
- ext的Ext.data.JsonStore不自动获取数据的问题记录
- 【Vegas原创】恢复Oracle Package的笨方法
- 【Vegas原创】恢复Oracle Package的笨方法
- 【Vegas原创】使用RMAN转移数据库到不同主机(Windows版)
- 【Vegas原创】使用RMAN转移数据库到不同主机(Windows版)
- 09年5月22日-感谢大家
- 09年5月22日-感谢大家
- 中医养生绝招:五首曲子保你健康
- 中医养生绝招:五首曲子保你健康