【发布时间】:2014-02-21 16:40:21
【问题描述】:
我在 Ext.grid.Panel 中指定了以下列:
{text: 'Home Country', dataIndex: 'homeCountryId', width: 250, xtype: 'country-column'},
xtype 是“country-column”,定义为:
Ext.define("RateManagement.view.Columns.CountryColumn", {
extend: 'Ext.grid.column.Column',
xtype: 'country-column',
text: 'Country',
editor: { xtype: 'country-combo', allowBlank: false, blankText: 'Country is required.'},
renderer: function(val) {
var locationStore = Ext.data.StoreManager.lookup('RateManagement.store.CountryStore');
var index = locationStore.findExact('value', val);
if (index != -1) {
var record = locationStore.getAt(index).data;
return record.label;
}
},
sortable: true
});
当我单击网格中的列标题(“本国”)时,它根本没有排序。
如何使它按record.label 排序以按字母顺序排序?
编辑:这是我更改模型的方式:
{name:'homeLocationId', type: 'string'},
{name:'homeLocation', type: 'string', convert: function (newValue, model) {
// homeCountryId is appened for uniqueness and additional sort
return (newValue ? newValue : '' ) + '_' + model.get('homeLocationId');
}
},
这是我的网格列:
{text: 'Home Location', dataIndex: 'homeLocationId', width: 250, xtype: 'location-column'},
【问题讨论】:
标签: javascript extjs