Excel problems speed etc

Excel problems speed etc

samsamtestsamsamtest Posts: 52Questions: 15Answers: 1
edited June 2019 in Free community support

Hi,
I need some help. I have purchased the support credits.
But I am in urgent need of help to get the excel work today.

  1. Excel speed. The speed is treble for data over 6000 entries it takes around 30 sec before it took around 2 sek.
  2. The format is strange. Its docent come out correct on excel. It changes some time comma to dot and dot to comma and sometimes rakes away them.

I have added part of my code below. But I am not able to put hole code up.
It would be great if I can use my credits for Skype so I can share my screen etc.

var DataTable = $("#" + Table_ID).DataTable({
                language: {
                    "decimal": ",",
                    "thousands": ".",
                    "info":           "_START_ to _END_ of _TOTAL_ entries",
                    "infoEmpty":      "",
                    "infoFiltered":   "(_MAX_ total entries)",
                    "search": "_INPUT_",
                    "searchPlaceholder": "Global Search",
                        "lengthMenu":     "_MENU_",
                           },`
                           
               buttons: [
                    {extend: 'excel',className: "buttonsToHide", exportOptions: { columns: ':visible', 
                    format: {body: function(data, row, column, node) {data = $('<p>' + data + '</p>').text(); 
                    return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;} } } },
                    {extend: "copy", className: "buttonsToHide"},
                    {extend: 'csv',  className: "buttonsToHide", charset: 'UTF-32', fieldSeparator: ';',  bom: true, },
                    {extend: "pdf", className: "buttonsToHide"},
                        ], 
                                  
                dom:
                "<'row'<'col-sm-12 table-controls'fBli>>" +  "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-3'><'col-sm-12'p>>",
                  "processing": true,
                "magicGoFaster": true,
                "search": {
                    "regex": true
                },
                
                     "ajax": url,
                
 
                /*columnDefs: [
                    { targets: columnAlignment, className: 'td-right'},
                    { targets: '_all', className: 'td-left'},
                ],
                orderCellsTop: true,*/

                 
                
                "footerCallback": function ( row, data, start, end, display ) {
                    var api = this.api();
                    var footerColumnArray = {};
                    var panelIdsExist = [];

                    $.each(footerColumn, function( index, value ) {
                        var intVal = function (index) {
                            return typeof index === 'string' ?
                            //index.replace(/[,.\s]/g, '').replace(/[\$,₹]/g, '') * 1 :
                            index.replace(/[.\s]/g, '').replace(/[,]/g, '.') * 1 :
                                typeof index === 'number' ?
                                    index : 0;
                        };
                        thousanSep = value.thousand_sep;
                        var decimalValue = value.decimal;

                        var columnTotal = api
                            .column( index, { search: 'applied' } )
                            .data()
                            .reduce( function (a, b) {
                                var resultValue = intVal(a) + intVal(b);
                                return resultValue.toFixed(0).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1'+thousanSep);
                            }, 0 );

                        var resultSUm = api
                            .column( index, { search: 'applied' } )
                            .data()
                            .reduce( function (a, b) {
                                return intVal(a) + intVal(b);
                            }, 0 );

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited June 2019

    Hi @samsamtest ,

    This thread here might help - it's showing that the most recent release has a performance issue with a large dataset. Can you confirm which version you are using - if it's not 1.10.18, can you upgrade first to that, then if no joy, could you try 1.10.16.

    If that doesn't help, we would really need to see this in motion, either in a test case or a link to your page. Diagnosing performance issues without seeing it is tricky. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    Answer ✓

    What version of Buttons are you using? I believe there have been some speed enhancements for Excel in the latest versions. You might try the latest if you are not using it now.

    Looks like you are using data.replace(',', '.'). Are you saying this isn't working? Without being able to see an example with your data its hard to say what the problem might be. Can you provide a simple test case using a sample of your data and replicating issue #2?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • samsamtestsamsamtest Posts: 52Questions: 15Answers: 1

    I am using
    DataTablesNew version available1.10.18
    ButtonsUp to date1.5.6

    Can I use my credits as a Skype message so I can Share my screen ?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    It would be worth trying 1.10.16 first. Screen sharing can be useful, but if you could link to your page, that would be the most helpful right now.

This discussion has been closed.