ExtJS数据存储不排序
ExtJS data store does not sort
我使用ExtJS 4.2并创建了一个带有分类器的商店。存储从JSONP web服务调用加载数据很好,但它拒绝排序。下面是我的模型、存储和加载调用的表示。
型号:
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和分拣机配置没有在代理上设置,而是在存储上设置,如下所示:
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'
}
}
});
相关文章:
- JavaScript数组排序(函数)用于对表行进行排序,而不是排序
- 使用promise和mongoose对文档进行排序
- Selectize.js:如何对整数值的选项进行排序
- Javascript排序的图像弹出窗口..可以't单独弹出
- 如何通过引用var Using DataTables来进行分页或排序
- 存储多个Json对象,然后对其进行排序
- 量角器:如何在数组中存储值,然后进行排序
- JavaScript 将文本框存储中的值引入数组中,创建新数组进行排序
- 将表排序保存在本地存储中
- jQuery - 本地存储排序字符串化对象顺序
- 如何根据本地存储中的变量快速排序
- ExtJS数据存储不排序
- 如何在ExtJS存储中获取记录的预排序索引
- 如何在数组中存储排序值的索引键
- 在JavaScript和MySQL中存储列表排序顺序的替代方法
- 支持XML数据存储的可编辑网格,具有行编辑/排序/重新排序功能
- 如何在Redux中存储一个排序集,并根据不同的键对其快速排序
- 如何对本地存储中的嵌套键进行数字排序
- 使用本地存储的可排序列表函数出错
- 当使用jquery拖放时,如何在cookie中存储排序表行