How works SortNormalizer?

Hello,

i’m trying to use the SortNormalizer to make a custom sort on a ListGrid. Here is my code:

        ListGridField nameField = new ListGridField("name");
        nameField.setSortNormalizer(new SortNormalizer(){

		public double normalize(ListGridRecord record, String fieldName) {
			return 0;
		}
        	
        });

The method ‘normalize’ returns a double value. Could anyone give a quick example how to use it. I try to sort not just over the ‘name’ but also over the ‘type’. Thank you.

SortNormalizer has been updated in SVN to have a return type Object in order to support String comparators.

Thank you thats works perfectly!! :slight_smile:

But it seems that the SortNormalizer has no effect to the sortByProperty method on the grid. Could that be?