Wijmo 5 [Flex Grid]

Remove the dollar sign from currency format

by thonyl19

HTML

<script src="http://cdn.wijmo.com/5.20161.164/controls/wijmo.min.js"></script>
<link rel="stylesheet" href="http://cdn.wijmo.com/5.20161.164/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.20161.164/controls/wijmo.grid.min.js"></script>
 <div id="theGrid" style="width: 100%; height: auto;"></div>

JavaScript

$(document).ready(function () {
            var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
                data = [];
            for (var i = 0; i < countries.length; i++) {

                    data.push({
                        country: countries[i],
                        downloads: Math.round(Math.random() * -20000),
                        sales: Math.random() * -10000,
                        expenses: Math.random() * 5000
                    });

            }
            var grid = new wijmo.grid.FlexGrid('#theGrid', {
                autoGenerateColumns: false,
                columns: [
                  { header: 'Country', binding: 'country', width: '*', format: '$n' },
                  { header: 'Download', binding: 'downloads' },
                  { header: 'Sales', binding: 'sales', format: 'c' },
                  { header: 'Expense', binding: 'expenses' },
                ],
                itemsSource: data
            });
            grid.itemFormatter = function (panel, r, c, cell) {
                if (panel.cellType == wijmo.grid.CellType.Cell) {
                    // remove the dollar sign
                    var col = panel.columns[c];
                    if (col.binding == 'sales') {
                        if (cell.innerHTML.indexOf("$") != -1) {                         
                            cell.innerHTML = cell.innerHTML.replace("$", "USD ");                         
                        }
                    }
                }
            }    
          
        });