ExtJS data warehouse does not sort

I am using ExtJS 4.2 and created a store with a sorter. The store loads data from the JSONP service only in order, but it refuses to sort. Below is a view of my model saving and loading a call.

Model:

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 } ] }); 

Store:

 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' } } }); 

Combobox component using storage:

  { 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' } 

Actual call to download:

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

The data is loading just fine, but the store refuses to sort my data. I load over 100 dynamic records into combobox and need this function. If someone can give an idea of ​​what I am doing wrong, I would really appreciate it.

+4
source share
1 answer

sortOnLoad, the remoteSort and sorter configurations are not defined in the proxy, instead they are installed in the repository as follows:

 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' } } }); 
+18
source

Source: https://habr.com/ru/post/1499433/


All Articles