How do I get the sortType for a field in an ExtJS store?
This doesn't work:
var sortType = myStore.fields.get('MyFieldName').sortType;
When you pass a string as sortType then it is converted to a function in the constructor of Ext.data.Field, so you need to compare that function with available sortTypes to get the correct sortType string
var sortTypeFn = myStore.fields.get('MyFieldName').sortType;
var sortType = '';
Ext.iterate(Ext.data.Types, function(key, obj) {
if(obj.sortType == sortTypeFn) {
sortType = key;
return false;
}
});
console.log(sortType);