title: Filter and sort positive and negative numbers with decimal
body: <p>I am using <code>angularjs ui-grid</code> to display the data in tabular form. Data is binding very well in a grid. In a grid, few columns have positive and negative numbers with <code>angularjs</code> currency filter applied on it. </p>
  
  <p>Now when I filter rows with it doesn't work as per requirements.</p>
  
  <p>I am using below code:</p>
  
  <pre><code>                               cellFilter: 'customCurrencyFormat:"hideZero"',                               
                                  filter: {
                                        condition: function(searchTerm, cellValue) {
                                          console.log(':::cellValue:::', cellValue);
                                          searchTerm = searchTerm.replace(/^-?[0-9]\d*(\.\d+)?$/g, '');
                                          console.log(':::searchTerm:::', searchTerm);
                                          var strippedValue = (cellValue + '').replace(/^-?[0-9]\d*(\.\d+)?$/g, '');
                                          console.log(':::strippedValue:::', strippedValue);
                                          return strippedValue.indexOf(searchTerm) &gt;= 0;
                                        }
                                      },
                                  filterCellFiltered:true,
  </code></pre>
  
  <p>Please find below code of <code>customCurrencyFormat</code>:</p>
  
  <p>HelperServices.filter('customCurrencyFormat',function($filter){
      return function(val, cond , decimalPlaces){</p>
  
  <pre><code>    if(typeof decimalPlaces =='undefined' || decimalPlaces ==null ){
          decimalPlaces = 2;
      }
  
      if(val == "0" &amp;&amp; cond == "showZero"){
          return ($filter('currency')(val, "", decimalPlaces));
      }else if(val == 0 &amp;&amp; cond == "hideZero"){
          return null;
      }else{
          if(val &lt; 0){
              return ($filter('currency')(val, "", decimalPlaces)).replace("(", "-").replace(")", "");
          }else{
              return ($filter('currency')(val, "", decimalPlaces));
          }
      }
  }
  </code></pre>
  
  <p>});</p>
  
  <p>Showing blank in place of 0 is as per requirement. With this filters the values are coming if I enter <code>,</code> in filter. And even without <code>,</code>, it is giving some unexpected results. Numbers with decimal never works with these filters.</p>
  
  <p>User will enter number without <code>,</code> in filter input box. If no sign is given, display positive and negative number. If <code>-</code> sign is given, only negative number will come. </p>
  
  <p><strong>Update</strong>
  <a href="http://plnkr.co/edit/aItKADZisXWJfIDdPB9j?p=preview" rel="nofollow noreferrer">Plunker Demo</a></p>
  
  <p>Please have a look at screenshots:</p>
  
  <p><a href="https://i.stack.imgur.com/1dNQ7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1dNQ7.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/zv325.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zv325.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/sBuL0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sBuL0.png" alt="enter image description here"></a></p>