Hi,

Can't believe this has not come up before really, but am using strings in models with useNull true.


When come to sort by one of these fields you get the data appearing in the middle of the data when you have a null value.


I've tracked it down to the following in Ext.data.SortTypes



Code:



asUCString : function(s) {
return String(s).toUpperCase();
},

It seems that String(null) or String(undefined) results in "null" or "undefined".

This is clearly wrong.

My fix:



Code:



Ext.define('Altus.overrides.data.Types', {
override: 'Ext.data.Types',


requires: [
'Ext.data.SortTypes'
]
},
function() {
Ext.apply(Ext.data.SortTypes, {
asNullableUCString: function(s) {
if (s) {
return Ext.data.SortTypes.asUCString(s);
}
return s;
}
});


Ext.data.Types.STRING.sortType = Ext.data.SortTypes.asNullableUCString;
});

Sorry, not got time to craft a case, but I'm seeing the effect with a combobox containing users, a template that renders "displayName (username)" or "username", and a null displayName.

You can try "String(null)" in your console to verify that bit though.


There are other uses of "String(s)" in that class that probably warrant the same treatment too.


Cheers,

Westy