Ext.Ajax.request Sencha Touch

时间:2012-01-05 15:55:51

标签: sencha-touch extjs

我想发出一个简单的请求,例如Ext.Ajax.request,并将其显示在列表中。但它不起作用。

我有这样的网址

  

http://server/GetContacts.aspx?CustAccount=10019

有人能告诉我它究竟是如何运作的以及我应该考虑什么吗?

这是我回来的一个例子。

{
  "HasError": false,
  "ErrorString": "",
  "Data": [
    {"ContactPersonId":"","Name":"","FirstName":"","MiddleName":"","LastName":"","Phone":"","CellularPhone":"","Telefax":"","Email":"","Url":"","Address":"","ZipCode":"","City":"","Street":"","Country":"","Function":""}
  ]
}

1 个答案:

答案 0 :(得分:0)

    Ext.regModel('kunden', {
                    idProperty: 'id',
                    fields: [
                        { name: 'ContactPersonId', type: 'string' },
                        .
                        .
                        .

                        { name: 'Function', type: 'string' }

                    ]
                });

                Ext.regStore('kundenStore', {
                    model: 'kunden',
                    sorters: [{
                        property: 'LastName'
                    }],

                    proxy: {
                        type: 'ajax',
                        url: 'http://server/GetContacts.aspx?CustAccount=10019'
                    },
                    reader: {
                        type: 'json',
                        root: 'Data'
                    }
                });
NotesApp.views.kundenList = new Ext.List({
                    id: 'kundenList',
                    store: 'kundenStore',
                    grouped: true,
                    indexBar    : true,
                    itemTpl: '<div class="list-item-title">{firstname} {lastname}</div>' +'<div class="list-item-narrative">{email}</div>',
                    listeners: {}
                    }
                });

它可以很容易XP