Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ExtJS数据存储未排序_Javascript_Sorting_Extjs_Store - Fatal编程技术网

Javascript ExtJS数据存储未排序

Javascript ExtJS数据存储未排序,javascript,sorting,extjs,store,Javascript,Sorting,Extjs,Store,我正在使用ExtJS4.2并创建了一个带有分类器的商店。存储从JSONPWeb服务调用加载数据很好,但拒绝排序。下面是我的模型、存储和加载调用的表示 型号: Ext.define('Desktop.models.products.DtoProductFamilyModel', { extend: 'Ext.data.Model', fields: [ { name: 'ProductFamilyId', type: 'string', us

我正在使用ExtJS4.2并创建了一个带有分类器的商店。存储从JSONPWeb服务调用加载数据很好,但拒绝排序。下面是我的模型、存储和加载调用的表示

型号:

Ext.define('Desktop.models.products.DtoProductFamilyModel', {
extend: 'Ext.data.Model',
fields: [
    {
        name: 'ProductFamilyId',
        type: 'string',
        useNull: false,
        defaultValue: Util.getBlankGuid()
    },
    {
        name: 'ParentProductFamilyId',
        type: 'string',
        useNull: true,
        defaultValue: Util.getBlankGuid()
    },
    {
        name: 'BaseItemId',
        type: 'string',
        useNull: true,
        defaultValue: Util.getBlankGuid()
    },
    {
        name: 'Name',
        type: 'string',
        useNull: false,
        defaultValue: ''
    },
    {
        name: 'DisplayName',
        type: 'string',
        useNull: false,
        defaultValue: ''
    },
    {
        name: 'ExternalReferenceId',
        type: 'string',
        useNull: true,
        defaultValue: null
    }
]
});
商店:

Ext.define('Desktop.stores.products.GetProductFamiliesStore', {
extend: Ext.data.Store,
model: 'Desktop.models.products.DtoProductFamilyModel',
proxy: {
    type: 'jsonp',
    url: 'http://www.somejsonpwebservice.com',
    method: 'GET',
    pageParam: false, 
    startParam: false, 
    limitParam: false,
    timeout: 9000000,
    noCache: true,
    headers: { 'Content-Type': 'application/json;charset=utf-8' },
    sorters: [{
        property: 'Name',
        direction: 'ASC'
    }],
    sortRoot: 'Name',
    sortOnLoad: true,
    remoteSort: false,
    reader: {
        type: 'json'
    }
}
});
使用存储的组合框组件:

    {
        xtype: 'combo',
        zzid: 'cmbProductManufacturersFamily',
        store: 'Desktop.stores.products.GetProductFamiliesStore',
        width: 250,
        labelWidth: 50,
        forceSelection: true,
        fieldLabel: Util.translate('Family'),
        emptyText: 'Select Product Family',
        margin: '0 0 0 10',
        displayField: 'Name',
        valueField: 'ProductFamilyId'
    }
对加载存储的实际调用:

this.stoProductFamilies = this.cmbProductManufacturersFamily.getStore();
this.stoProductFamilies.load()

数据加载正常,但存储拒绝对我的数据进行排序。我正在将100多条动态记录加载到一个组合框中,需要这个功能。如果有人能告诉我我做错了什么,我将不胜感激。

sortOnLoad、remoteSort和sorters配置不是在代理上设置的,而是在存储上设置的,如下所示:

Ext.define('Desktop.stores.products.GetProductFamiliesStore', {
    extend: Ext.data.Store,
    model: 'Desktop.models.products.DtoProductFamilyModel',
    sorters: [{
        property: 'Name',
        direction: 'ASC'
    }],
    sortRoot: 'Name',
    sortOnLoad: true,
    remoteSort: false,
    proxy: {
       type: 'jsonp',
       url: 'http://www.somejsonpwebservice.com',
       method: 'GET',
       pageParam: false, 
       startParam: false, 
       limitParam: false,
       timeout: 9000000,
       noCache: true,
       headers: { 'Content-Type': 'application/json;charset=utf-8' },
       reader: {
           type: 'json'
       }
    }
});