初学extjs,    
后台ProcessQuery.ashx:
string xmlString = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<NewDataSet>\n" +
"<Table>\n" +
"<a>1</a>\n" +
"<b>2</b>\n" +
"<c>3</c>\n" +
"<d>4</d>\n" +
"<e>5</e>\n" +
"<f>6</f>\n" +
"<g>7</g>\n" +
"<h>8</h>\n" +
"</Table>\n" +
"</NewDataSet>";
 context.Response.ContentType = "Application/xml";
context.Response.Write(xmlString);前台:
Ext.onReady(function() {
   
    var dsCust = new Ext.data.Store({
       
        proxy: new Ext.data.HttpProxy({ url: 'PeocessQuery.ashx'}),
        reader: new Ext.data.XmlReader({
              record: "Table",
           },
      ['a', 'b', 'c', d', 'e', 'f', 'g', 'h'])
    });
   dsCust.load();
   dsCust.on('load', function() { alert(123); })
   alert(dsCust.getCount());
})
测试时alert不弹出123, 只弹出0,请问哪块出了问题。

解决方案 »

  1.   

    Ext.onReady(function(){
            var dsCust = new Ext.data.Store({
                   
                        proxy: new Ext.data.HttpProxy({ url: 'PeocessQuery.ashx'}),
                        reader: new Ext.data.XmlReader({
                              record: "Table"
                          },
                      ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
                    });
                  dsCust.load();
                  dsCust.on('load', function() { alert(123); })
                  alert(dsCust.getCount());
    })
      

  2.   

    var dsCust = new Ext.data.Store({
                   
                        proxy: new Ext.data.HttpProxy({ url: 'ProcessQuery.ashx'}), //这里
                        reader: new Ext.data.XmlReader({
                              record: "Table"   //,
                          },
                      ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']) 
                    });
                  dsCust.load();
                  dsCust.on('load', function() { alert(123); })
                  alert(dsCust.getCount());
      

  3.   

    record:'table' 那块 我是发帖时多写了一个逗号,实际里是没有的 ,请问除了那还有哪块有问题
      

  4.   

    可能也是你发贴时敲错了,['a', 'b', 'c', d', 'e', 'f', 'g', 'h']) 
      

  5.   

    应该是编码问题,我后台生成的xml字符串的字节<a><b>那些 有的是中文,我以为是语法问题,所以为了方便帖子举的例子直接就都是英文了,呵呵 ,请问字符编码问题 是后台处理还是前台处理呢,我后台试了很多种输出编码为utf-8的 还是没有效果,前台有设置方法吗