最近写了一个Ext中的程序,是使用ComboBox远程加载数据的
写好以后在IE下可以正常运行,但是在FF中却无法显示,郁闷的很,下面把代码贴出来,高手帮忙看看<script type="text/javascript">
Ext.onReady(function(){

var store=new Ext.data.Store({
proxy:new Ext.data.HttpProxy({url:'http://localhost:8080/demo/person'}),
reader:new Ext.data.JsonReader(
{
totalProperty:'totalProperty',
root:'list'
},[
{name:'id'},
{name:'name'}
])
}); var combo=new Ext.form.ComboBox({
store:store,
displayField:"name",
valueField:"id",
mode:"remote",
emptyText:'选择人物...',
triggerAction:'all',
fieldLabel:'人物信息',
minListWidth:200,
pageSize:5
}); var form=new Ext.form.FormPanel({
title:'数字输入框',
width:300,
height:100,
frame:true,
items:[combo],
renderTo:document.body
});
});
</script>

解决方案 »

  1.   

    <script type="text/javascript">
    Ext.onReady(function(){

    var store=new Ext.data.Store({
    proxy:new Ext.data.HttpProxy({url:'http://localhost:8080/demo/person'}),
    reader:new Ext.data.JsonReader(
    {
    totalProperty:'totalProperty',
    root:'list'
    },[
    {name:'id'},
    {name:'name'}
    ])
    }); var combo=new Ext.form.ComboBox({
    store:store,
    displayField:"name",
    valueField:"id",
    mode:"remote",
    emptyText:'选择人物...',
    triggerAction:'all',
    fieldLabel:'人物信息',
    minListWidth:200,
    pageSize:5
    }); var form=new Ext.form.FormPanel({
    title:'数字输入框',
    width:300,
    height:100,
    frame:true,
    items:[combo],
    renderTo:document.body
    });
    });
    </script>
      

  2.   

    先说下 我是菜鸟.. 我把你代码COPY看了下 在FF能显示出面板来啊..  估计是数据的问题 你看你的后台发的数据是不是{totalProperty:    ,root:   ,... }什么的
      

  3.   

    是的啊,我把后台代码贴出来,你看看
    //数据对象
    public class JSONObject {
    private int totalProperty;
    private List list; public JSONObject() {
    super();
    // TODO Auto-generated constructor stub
    } public int getTotalProperty() {
    return totalProperty;
    } public void setTotalProperty(int totalProperty) {
    this.totalProperty = totalProperty;
    } public List getList() {
    return list;
    } public void setList(List list) {
    this.list = list;
    }}
    //控制器代码
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html;charset=GBK");
    request.setCharacterEncoding("GBK");
    PersonDao personDao = new PersonDao();
    int start = 0, limit = 5;
    if (request.getParameter("start") != null) {
    start = Integer.parseInt(request.getParameter("start"));
    }
    if (request.getParameter("limit") != null) {
    limit = Integer.parseInt(request.getParameter("limit"));
    }
    JSONObject jsonObject=new JSONObject();
    int totalRecord=personDao.getTotalRecord();
    List list = personDao.findPerson(start, limit);
    jsonObject.setTotalProperty(totalRecord);
    jsonObject.setList(list);
    Gson gson = new Gson();
    String persons = gson.toJson(jsonObject);
    PrintWriter out = response.getWriter();
    out.println(persons);
    out.close();
    }
      

  4.   

    我遇到的问题和你差不多 ,estjs4 结合struts2 grid 访问action 死活进不去,.jsp,servlet都能正常进
      

  5.   

    extjs2的时候还不这样 也不知道4是bug多还是兼容性不好 还是对其他框架的版本 及其兼容性要求高