Custom sort requiring two clicks

I have copy/pasted sample code for a custom sort. Unfortunately, what I am seeing requires the user to click twice before they see any results.

I don’t mean “double-click”, but two individual clicks. The directional indicators switch with each click, but the actual sort is only affected every other click:

http://webix.com/snippet/f063b67f
or
http://webix.com/snippet/56796441

Please let me know if there is a way to do this better or different, so it sorts with each click.

Hello,

I apologize for the misleading documentation, we will correct it shortly.

The functions included into a custom sorting type receive not the whole item object, but cell values as parameters. So the correct code is:

webix.DataStore.prototype.sorting.as.bystartdate = function(a,b){ 
	return (a*1) > (b*1) ? 1 : -1;
}

Please, check the updated snippet: http://webix.com/snippet/3e4c5fed

If you require the whole item objects for sorting, you need to define a sorting function as:

function bystartdate(a,b){ 
  return (a.year*1) > (b.year*1) ? 1 : -1;
}
...
{ id:"year", sort:bystartdate }

http://webix.com/snippet/8e6e9a49