Diana123456,
тоже самое чуть покороче
$("#buttonSort").click(function() {
function d(a) {
return (new Date(a)).getTime()
}
var e = $(":checked").index("[name='sort']"),
c = [{key: "name"}, {key: "lastname"}, {key: "dateofstart",foo: d}, {key: "dateofend",foo: d}][-1 < e ? e : 0];
dataObj.items.sort(function(a, b) {
a = a[c.key];
b = b[c.key];
c.foo && (a = c.foo(a), b = c.foo(b));
return a < b ? -1 : a > b ? 1 : 0
});
$(".entered_data").html("");
testProject.render()
});