【问题标题】:Ext.Ajax.request Sencha TouchExt.Ajax.request Sencha Touch
【发布时间】:2012-01-13 09:10:11
【问题描述】:

我想发出像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":""}
  ]
}

【问题讨论】:

    标签: sencha-touch extjs


    【解决方案1】:
        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可以这么简单

    【讨论】:

      猜你喜欢
      • 2012-05-27
      • 2012-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多