angularjs - Sorting angular ui-grid money column -


i'm trying sort grid on column values in dollars (with $ , , included) sorting doesn't work correctly on - there way sorting work on this, or if necessary, set values numbers , display money?

i have:

$scope.data = [     { 'value': '$1,000,000' },     { 'value': '$100,000' }, ....     { 'value': '$1,000' } ]; $scope.gridoptions = { enablesorting: true, data: $scope.data, columndefs: [ ...     { name: 'value', field: 'value', width: 110 } ] 

i dont see exact html , other js code , tried myself click on column header sort column. if missed in code please include it.i posted working example.,

html code ,

<!doctype html> <html ng-app="app">   <head>     <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.js"></script>     <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-touch.js"></script>     <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script>     <script src="http://ui-grid.info/release/ui-grid.js"></script>     <link rel="stylesheet" href="http://ui-grid.info/release/ui-grid.css" type="text/css">     <link rel="stylesheet" href="main.css" type="text/css">   </head>   <body>  <div ng-controller="mainctrl">   <br>   <br>   <div id="grid1" ui-grid="gridoptions1" class="grid"></div>   <br> </div>     <script src="app.js"></script>   </body> </html> 

js code

var app = angular.module('app', ['nganimate', 'ngtouch', 'ui.grid']);  app.controller('mainctrl', ['$scope', '$http', 'uigridconstants', function ($scope, $http, uigridconstants) {    $scope.data = [     { 'value': '$1,000,000' },     { 'value': '$100,000' },     { 'value': '$1,000' } ];   $scope.gridoptions1 = {     enablesorting: true,     columndefs: [       { field: 'value',         name:'value'},     ],   };       $scope.gridoptions1.data = $scope.data; }]); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -