Report bug

Report bug

nlocatelnlocatel Posts: 4Questions: 1Answers: 0

Hi, I need to contact the creator of the plugin, just to tell a couple of errors I came through when using it, both datatables and buttons.

Answers

  • allanallan Posts: 63,786Questions: 1Answers: 10,511 Site admin

    Thanks for getting in touch. I am the created of DataTables and Buttons, please feel free to post bug reports here. Please be sure to include links to test cases showing the issues as well.

    Allan

  • nlocatelnlocatel Posts: 4Questions: 1Answers: 0
    edited April 2016

    No test cases needed. I will point out the portion of code they occur, because I had to adapt the code in order to get going.

    1) It would be nice to be able to show a status message at any time, for example:

        /**
        * Added by Nicolas
        * Need to show any status message when wanted
        */
        function _fnShowStatus(sZero)
        {
            var settings = DataTable.settings[0];
            
            var row = $( '<tr/>' )
                .append( $('<td />', {
                    'valign':  'top',
                    'colSpan': _fnVisbleColumns( settings ),
                    'class':   settings.oClasses.sRowEmpty
                } ).html( sZero ) )[0];
     
            var body = $(settings.nTBody);
        
            //body.children().detach();
            body.empty();
            body.append( row );
        }
    

    2) I had to change this (in order to export a large number of rows > 4000):

            // Initial data
           if ( data ) {
                this.push.apply( this, data.toArray ? data.toArray() : data );
             }
     for this:
            // Initial data
            if ( data ) {
                //this.push.apply( this, data.toArray ? data.toArray() : data );
                var QUANTUM = 1000;
                for (var i = 0, len = data.length; i < len; i += QUANTUM) {
                    this.push.apply( this, data.toArray ? data.toArray().slice(i, Math.min(i+QUANTUM, len)) : data.slice(i, Math.min(i+QUANTUM, len)) );
                }
            }
    

    3) It would be nice not to be forced to use defaultContent in _fnGetCellData when using nested objects. If an object is NULL, then don't throw a nasty alert if no default content is used, just put blank.

    Thanks, Nicolas

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

  • allanallan Posts: 63,786Questions: 1Answers: 10,511 Site admin

    Hi Nicolas,

    Thanks for the feedback.

    1) Sounds like a perfect use case for a plug-in.

    2) Could you tell me where that code is please? I've just grep'ed the entire DataTables code base and I don't see it anywhere.

    3) I'm afraid I disagree on this one. If the data is null it means an absence of data - it does not mean an empty string (this isn't Oracle!). DataTables should be told what to display in the case of null data. Simply including defaultContent doesn't seem too arduous to me.

    Allan

  • nlocatelnlocatel Posts: 4Questions: 1Answers: 0

    Hi Allan,

    2) That is inside
    _Api = function ( context, data ){
    ...
    this.push.apply(...)
    ...
    }
    aprox around line 6790

    Nice to learn from someone who knows javascript.
    Nicolas

  • allanallan Posts: 63,786Questions: 1Answers: 10,511 Site admin

    I guess I'm being a bit thick - can you give me the lin number of that bit of code in the 1.10.11 release file? I can't see it at all. The _Api function is there, but there isn't a call to this.push.apply.

    Allan

  • nlocatelnlocatel Posts: 4Questions: 1Answers: 0

    line 6826.
    push.apply was in place of:
    $.merge( this, data );

    Maybe you already solved it. In that case, sorry for the comes and goes.
    The issue was that in case I wanted to export around 10 thousands of rows to excel or csv, I couldn't. I had to patch your plugin. I will let you know if this new release makes it.

    Thanks a lot Allan. I would be nice to contact you by email from time to time to get some advice from you, if you can.

  • allanallan Posts: 63,786Questions: 1Answers: 10,511 Site admin

    Using the latest release is always best practice as will it will contain fixes and performance improvements.

    Feel free to create new threads here any time.

    Allan

This discussion has been closed.