ext的Ext.data.JsonStore不自动获取数据的问题记录
昨天在一个项目当中发现ext的JsonStore在IE的某些状况下并不能够自动从后台的Action获取json数据,问题原因到现在也没有查清楚。在本机的开发环境下对外发布服务一切正常,但是部署到公司的单元测试环境后,还是有些主机通过IE无法访问(用其他的浏览器比如火狐很正常)。 这里需要记录的就是问题的部分解决,原来通过本机设置JsonStore的autoLoad为true的时候,对外发布会一部分主机IE访问不正常,而改成了手动load数据,那么通过自己的开发环境对外发布服务一切正常。 typeStore =new Ext.data.JsonStore({ 这是原来设置的一个JsonStore ,设置的属性autoLoad:true 让这个页面被加载的时候,自动地通过url为root+'/issueType.do?method=getTypeList' 来从后台的Action加载数据,通过解析json数据来绘制前台。也就是这个设定在一部分IE浏览器下不能够正常实现。 具体解决的方法是不使用自动加载,设置为下面的方法 typeStore =new Ext.data.JsonStore({ 然后手动的拉数据来自于另外地方调用typeStore.load();将全部的init函数贴出来 function to_init(){ typeGrid = new Ext.grid.EditorGridPanel({ //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(); }; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |