Skip to content

Instantly share code, notes, and snippets.

@sakunyo
Created December 12, 2011 01:33
Show Gist options
  • Save sakunyo/1464097 to your computer and use it in GitHub Desktop.
Save sakunyo/1464097 to your computer and use it in GitHub Desktop.
Ext GridTable で Blankを常に下へ表示
Ext.override(Ext.util.Sorter, {
defaultSorterFn: function( o1, o2 ) {
var me = this,
transform = me.transform,
v1 = me.getRoot(o1)[me.property],
v2 = me.getRoot(o2)[me.property];
if (transform) {
v1 = transform(v1);
v2 = transform(v2);
}
if (v1 == '' && v2 == ''){
return 0;
}
if (v1 === ''){
return me.direction == 'ASC' ? 1 : -1;
}
if (v2 === ''){
return me.direction == 'ASC' ? -1 : 1;
}
return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment