0
我有以下列在我的Ext.grid.Panel指定
{text: 'Home Country', dataIndex: 'homeCountryId', width: 250, xtype: 'country-column'},
的xtype
是「國列」,其定義爲:
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'},
我不知道你的意思'dataIndex:「標籤」,',我不知道你所說的'渲染器顯示「首頁Country''的意思。如果你有時間,可以用一個例子來詳細說明一下嗎? – user1477388
我改變了我的答案) –
感謝您的努力,但我在工作中遇到了一些麻煩。我有自己的國家,東道國,首頁位置和主機位置,所以我必須爲每個標籤創建單獨的標籤?我改變你的例子,使用HomeCountryName作爲'dataIndex',它似乎工作;不過,如果我在礦上做這個,那麼這個列就顯得空白。這裏是更新的jsfiddle http://jsfiddle.net/KLX5q/2/ – user1477388