The sort configuration. Accepts the same values as the sort option.
Returns:Array
—The current sort configuration. Returns undefined instead of an empty array if the DataSource instance has not performed any sorting so far.
<script>var dataSource =newkendo.data.DataSource({data:[{name:"Jane Doe",age:30},{name:"John Doe",age:33}]});
dataSource.sort({field:"age",dir:"desc"});var view = dataSource.view();/* The result can be observed in the DevTools(F12) console of the browser. */console.log(view[0].name);// displays "John Doe"</script>
<script>var dataSource =newkendo.data.DataSource({data:[{name:"Jane Doe",age:30},{name:"John Doe",age:33}],sort:{field:"age",dir:"desc"}});var sort = dataSource.sort();/* The result can be observed in the DevTools(F12) console of the browser. */console.log(sort.length);// displays "1"/* The result can be observed in the DevTools(F12) console of the browser. */console.log(sort[0].field);// displays "age"</script>