Scroller row calculation fails during table initialization

Scroller row calculation fails during table initialization

egisegis Posts: 3Questions: 0Answers: 0

I do not have a test case but problem looks obvious.
I have a server side datatable with scroller extension and during table initialization, when it waits ajax response, resize event is fired (Metronic library fires). At this point datatable is not initialized yet and resize event triggers row height recalculation. Calculation fails with row height 0 and later on this size produces NaN

Replies

  • egisegis Posts: 3Questions: 0Answers: 0

    Actually I have a patch for version 1.2.2 but do not see possibility to attach it. How could I submit it?

  • egisegis Posts: 3Questions: 0Answers: 0

    I have not found any civilized way to submit patch, thus pasting as a diff (against 1.2.2) below:

    --- module/src/Scroller/js/dataTables.scroller.js   (revision 879e1a170258abcbab80a054ec0b2d7d42220497)
    +++ module/src/Scroller/js/dataTables.scroller.js   (revision )
    @@ -904,18 +904,22 @@
            $('div.'+dt.oClasses.sScrollBody, container).append( nTable );
     
            var appendTo;
    +       var removeNode = container;
            if (dt._bInitComplete) {
                appendTo = origTable.parentNode;
            } else {
    -           if (!this.s.dt.nHolding) {
    -               this.s.dt.nHolding = $( '<div></div>' ).insertBefore( this.s.dt.nTable );
    -           }
    +           if (!this.s.dt.nHolding || $(this.s.dt.nHolding).is(":visible") == false) {
    +               appendTo = $( '<div></div>' ).insertBefore( this.s.dt.nTable );
    +               // clear all trash
    +               removeNode = appendTo;
    +           } else {
    -           appendTo = this.s.dt.nHolding;
    -       }
    +               appendTo = this.s.dt.nHolding;
    +           }
    +       }
     
            container.appendTo( appendTo );
            this.s.heights.row = $('tr', tbody).eq(1).outerHeight();
    -       container.remove();
    +       removeNode.remove();
        },
    
This discussion has been closed.