Extjs Sencha Ext JS数据未显示在网格中

Extjs Sencha Ext JS数据未显示在网格中,extjs,Extjs,嗨,我是Sencha Extjs的新手,我正在尝试从我在asp.net中创建的API中提取数据 在开发工具中,我可以获得数据,但它没有显示在网格中。有人能帮忙吗 这是我做的代码 这就是模型 Ext.define('VidlyViews.model.Customers', { extend: 'VidlyViews.model.Base', fields: [ 'name', 'membershipType', 'isSubscribeToNewsLetter', 'birthDate'

嗨,我是Sencha Extjs的新手,我正在尝试从我在asp.net中创建的API中提取数据

在开发工具中,我可以获得数据,但它没有显示在网格中。有人能帮忙吗

这是我做的代码

这就是模型

Ext.define('VidlyViews.model.Customers', {
extend: 'VidlyViews.model.Base',

fields: [
    'name', 'membershipType', 'isSubscribeToNewsLetter', 'birthDate'
]
}))

这是商店

Ext.define('VidlyViews.store.Customers', {
extend: 'Ext.data.Store',
alias: 'store.customers',
model: 'VidlyViews.model.Customers',
autoLoad: true,

proxy: {
    type: 'jsonp',
    url: 'https://localhost:44300/api/customers',
    reader: {
        type: 'json',
        rootProperty: 'feed.entry'
    }
}
}))

这在classic/src/view/main文件夹中

Ext.define('VidlyViews.view.main.Customers', {
extend: 'Ext.grid.Panel',
xtype: 'customerlist',

requires: [
    'VidlyViews.store.Customers'
],

title: 'Customers',

store: {
    type: 'customers'
},

columns: [
    { text: 'Customer Name',  dataIndex: 'name', flex: 1 },
    { text: 'Membership Type', dataIndex: 'membershipType', flex: 1 },
    { text: 'Newsletter', dataIndex: 'isSubscribeToNewsLetter', flex: 1 },
    { text: 'Birthdate', dataIndex: 'birthDate', flex: 1 }
],

listeners: {
    select: 'onItemSelected'
}
}))


提前谢谢你

我已经解决了我的问题,希望将来能帮助别人

我将我的代理更改为:

proxy : {
    type : 'rest',
    actionMethods : {
       read : 'GET' 
    },
    url : 'https://localhost:44300/api/customers',
    useDefaultXhrHeader: false,
    reader: {
       type : 'json',
       headers: { 'Accept': 'application/json' },
       allDataOptions: {
            associated: true,
            persist: true
        },
       rootProperty : 'data'
    },
}
我用rest来提取数据。根属性就是数据。 在API(ASP.NET)中,我将IhhtpActionResult修改为

public IHttpActionResult GetCustomers(int start, int limit)
因为在sencha中,您可以获得分页的开始和限制,并在后端使用.Skip()和.Take()

看起来是这样的:

var customerDtos = customersQuery
            .OrderBy(c => c.CustomerId)
            .Skip(start)
            .Take(limit)
            .ToList();
return Ok(new { total = customerDtos.Count(), data = customerDtos });
我做的最后一步是像这样返回数据:

var customerDtos = customersQuery
            .OrderBy(c => c.CustomerId)
            .Skip(start)
            .Take(limit)
            .ToList();
return Ok(new { total = customerDtos.Count(), data = customerDtos });
rootProperty中的数据被识别为数据集合,total是API调用中可以识别的数据总数

我希望有帮助。我花了一整天的时间才弄明白哈哈哈