Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81923

Wrong format excel exporting

$
0
0

Hello I'm trying to export to excel but the format for thousand separator is not behaving correctly... When it's a number under 1.000.000 it writes "," as separator, when it's higher than 1.000.000, it writes "." my purpose is having "." always as the thousand separator. This is my code in case it helps... Thank you!

`
this.initTable = function(tableId, options, filters) {
var filterEvents;

if (appname.tableGeneratorFilters && filters) {
  filterEvents = appname.tableGeneratorFilters.init(filters);
}

var defaultOptions = {
  dom: 'ri<"detail-actions"><"table-actions">Bf<"filters"><"live-filters">tlp',
  buttons: [
    {
        extend: 'csv',
        charset: 'UTF-16LE',
        fieldSeparator: ';',
        bom: true
    },
    {
        extend: 'excel',
      exportOptions: {
        columns: ':visible',
        format: {
          body: function(data, row, column, node) {
            var value = $('<span>' + data + '</span>').text();

            return value;
          }
        }
      },
        filename: function(){
            var d = new Date();
            // TODO ... dd/mm/yyyy hh:mm:ss.
            return document.title + ' ' +d.toISOString();
        }
    }
  ],

  scrollX: true,
  columnDefs: [
    {
      orderable: false ,
      targets: "no-sort"
    },
    {
      width: "1%",
      targets: 0 }
  ],
  order: [[ 1, 'asc' ]],
  language: {
    search: "_INPUT_",
    searchPlaceholder: '',
    url: ctx + "/js-i18n/tables-i18n.json"
  }
};
var opts = $.extend({}, defaultOptions, options);

var table = $(tableId).DataTable(opts);`

Viewing all articles
Browse latest Browse all 81923

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>