我有一个组合框,它可以包含所有美国城市的值。在此组合框中,我想将"未选择"显示为第一个值,其他值应按字母顺序排序。所以我需要在对商店进行排序时解释"未选择"。如何在 ext js 排序中实现这一点?
对于 Asp.Net MVC,我使用的是这种方式:
var myList= (List<Country>())CommonLogic.GetAllCountries();
myList.Add(new Country() {Id = -1, Name= "None selected" });
myList= liste.OrderBy(p => p.Id).ToList();
ViewData["countries"] = myList;
或者您可以使用空文本选项:
var countryCombo = Ext.create('Ext.form.field.ComboBox', {
fieldLabel: 'Country',
renderTo: 'countryCombo ',
displayField: 'Name',
width: 500,
labelWidth: 130,
store: store,
queryMode: 'local',
typeAhead: true,
emptyText : 'None Selected'
});