<script type="text/javascript"> angular.module('listCtrl', ['ejangular']) .controller('PhoneListCtrl', function ($scope, $compile, $filter, $rootScope) { $scope.data = [ { accessGroupMarking: "Country1", targetDescription: "Iphone 6", targetName: "2064-prod_SYSA", targetNumber: "1", targetType: "z/OS" }, { accessGroupMarking: "Country2", targetDescription: "Lenovo SS", targetName: "ADV-160", targetNumber: "111", targetType: "Oracle" }, { accessGroupMarking: "Country3", targetDescription: "Andy's Lenovo T60", targetName: "ACM-T60", targetNumber: "12", targetType: "Windows" }, { accessGroupMarking: "Country4", targetDescription: "Lenovo T60", targetName: "ACM-", targetNumber: "101", targetType: "Mac" }, { accessGroupMarking: "Country5", targetDescription: " Apple T80", targetName: "ACM-T65", targetNumber: "222", targetType: "Linux" } ]; $scope.columns = [ { field: "targetType", headerText: "targetType", width: 100 }, { field: "targetNumber", headerText: "targetNumber", width: 100 }, { field: "targetName", headerText: "targetName", width: 100 }, { field: "targetDescription", headerText: "description", width: 100 } ]; }); ej.pvt.fnAscending = function (x, y) { if (y === null || y === undefined) return -1;
if (parseFloat(x) != NaN) return parseFloat(x) - parseFloat(y);
if (typeof x === "string") return x.localeCompare(y);
if (x === null || x === undefined) return 1;
return x - y; } ej.pvt.fnDescending = function (x, y) { if (y === null || y === undefined) return 1;
if (parseFloat(x) != NaN) return parseFloat(y) - parseFloat(x);
if (typeof x === "string") return x.localeCompare(y) * -1;
if (x === null || x === undefined) return -1;
return y - x; } |