angularjs - UI GRID date sorting -


when sorting,the date sorted according string,ie via first 2 characters.can u plz send code sorting in ui grid according date. i've tried sorting sort string format.

http://ui-grid.info/docs/#/tutorial has provided many examples demonstrating sorting.   please have @ below pluck. hope solves   http://plnkr.co/edit/buzf1zlnv2x6rhpszkug?p=preview  var app = angular.module('app', ['nganimate', 'ngtouch', 'ui.grid','ui.grid.movecolumns']);  app.controller('mainctrl', ['$scope', '$http', 'uigridconstants', function ($scope, $http, uigridconstants) {   var today = new date();   var nextweek = new date();   nextweek.setdate(nextweek.getdate() + 7);    $scope.highlightfilteredheader = function( row, rowrenderindex, col, colrenderindex ) {     if( col.filters[0].term ){       return 'header-filtered';     } else {       return '';     }   };    $scope.gridoptions = {     enablefiltering: false,     onregisterapi: function(gridapi){       $scope.gridapi = gridapi;     },     columndefs: [       // default       { field: 'name', headercellclass: $scope.highlightfilteredheader },       { field: 'mixeddate', displayname: "long date", cellfilter: 'date:"longdate"', filtercellfiltered:true, width: '25%',       },       {         field: 'phone',         filter: {           condition: function(searchterm, cellvalue) {             var strippedvalue = (cellvalue + '').replace(/[^\d]/g, '');             return strippedvalue.indexof(searchterm) >= 0;           }         }, headercellclass: $scope.highlightfilteredheader       },       // date filter       { field: 'mixeddate', cellfilter: 'date', width: '15%', filter: {           condition: uigridconstants.filter.less_than,           placeholder: 'less than',           term: nextweek         }, headercellclass: $scope.highlightfilteredheader       }     ]   };    $http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json')     .success(function(data) {       $scope.gridoptions.data = data;       $scope.gridoptions.data[0].age = -5;        data.foreach( function adddates( row, index ){         row.mixeddate = new date();         row.mixeddate.setdate(today.getdate() + ( index % 14 ) );         row.gender = row.gender==='male' ? '1' : '2';       });     });    $scope.togglefiltering = function(){     $scope.gridoptions.enablefiltering = !$scope.gridoptions.enablefiltering;     $scope.gridapi.core.notifydatachange( uigridconstants.datachange.column );   }; }]) .filter('mapgender', function() {   var genderhash = {     1: 'male',     2: 'female'   };    return function(input) {     if (!input){       return '';     } else {       return genderhash[input];     }   }; }); 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -