2009-09-23 80 views
0
var remoteLookupJsonStore = new Ext.data.JsonStore({ 
root : 'records', 
baseParams : { 
    column : 'fullName' 
}, 
fields : [ 
{ 
    name : 'name', 
    mapping : 'fullName' 
}, 
{ 
    name : 'id', 
    mapping : 'id' 
} 
], 
proxy : new Ext.data.ScriptTagProxy({ 
    url : 'LookupLoader.ashx' 
    //url: 'http://tdg-i.com/dataQuery.php' similar data 
}) 
}); 

var combo2 = { 
xtype : 'combo', 
fieldLabel : 'Search by name', 
forceSelection : true, 
displayField : 'name', 
valueField : 'id', 
hiddenName : 'customerId', 
loadingText : 'Querying....', 
minChars : 1, 
triggerAction : 'name', 
store : remoteLookupJsonStore 
}; 

此示例使用原始数据存储“http://tdg-i.com/dataQuery.php”。我的ashx处理程序以相同的格式返回数据,但数据不同。无论如何,当我使用我的ashx处理程序时,处理程序会被调用,它会返回数据,但组合总是处于加载状态,并且从不显示数据。 我假设问题出在我回来的数据上,但它的格式没问题,我改变的最后一件事是设置内容类型ExtJS combobox jsonDataStore

context.Response.ContentType =“application/json”;

但我仍然无法得到这个东西的工作,有什么建议吗?

这是来自我的处理程序的数据。 ({“totalCount”:“4”,“records”:[{“id”:1,“fullName”:“aaa bbb”},{“id”:2,“fullName”:'cc ddd “},{”id“:3,”fullName“:”ee ff“},{”id“:4,”fullName“:”gg hh“}]});

回答

0

您的第一条记录(id 1)缺少“fullName”,从而导致JSON无效JSON - 不确定这只是一个输入错误。

+0

我的不好,其复制粘贴错误,我试图修改样本数据! – hazimdikenli 2009-09-23 14:17:38

0
proxy : new Ext.data.ScriptTagProxy({ 
    url : 'LookupLoader.ashx' 
    //url: 'http://tdg-i.com/dataQuery.php' similar data 
}) 

以及看起来像查询同一个域中,我应该使用HTTPPROXY

所以你有它,这就是为什么它是由网站,但没有与提供的样本数据工作我的本地版本。