Sort dates not working

I use webix-jet.

— Model purchases.js —

`
define([],function(){
    var collection = new webix.DataCollection({ 
        url:"rest->/purchases", 
        save:"rest->/purchases" 
    });
    return {
        data: collection
    };
});
`

— View —

`
define([
	"models/purchases"
],function(purchases){

	var ui = {
		view:"datatable",
			columns:[
				{ id:"id",  header:"ID" },
				{ map:"(date)#end_date#", header:"End Date", sort:"date", format:webix.i18n.dateFormatStr}
			],
	};

	return {
		$ui: ui,
		$oninit:function(view){
			view.parse(purchases.data);
		}
	};
	
});
`

In “End Date” column data is not showed, every cell is empty.

  1. In case use
    id:"end_date"
    instead
    map:"(date)#end_date#"
    data is showed, but sorting not working.

  2. In case don’t use model and paste the same data from the server in view.parse method dates is showed and sort working very well:

`
	return {
		$ui: ui,
		$oninit:function(view){
			view.parse(
				[{
						"end_date": "2016,03,20",
						"id": 81,
					}, {
						"end_date": "2017,02,20",
						"id": 76,
					}, {
						"end_date": "2017,03,24",
						"id": 49,
					}
				]
			);
		}
	};
`

Can you help me sort dates when data loads from server side?

a) Mapping on data collection

You need to remove “map” instruction from a datatable and add it to the data collection

var collection = new webix.DataCollection({ 
   map:{
        end_date:"(date)#end_date#"
   },
   url:"rest->/purchases", 
   save:"rest->/purchases" 
});

http://docs.webix.com/api__link__datacollection_map_config.html

or

b) if this collection is used only for one datatable, it is quite normal to remove the data collection at all and define the “url” and “save” attributes directly on a datatable. In such case, data-mapping will work as expected.

In case b) mapping work.
In case a) mapping don’t work also. I don’t khow what i do wrong.