Giter Club home page Giter Club logo

Comments (13)

 avatar commented on July 21, 2024 1

Thank you - this is something I'm planning to look at either today or tomorrow depending on how things do. Its a known bug in the current release I'm afraid.

from scroller.

Andrew1178 avatar Andrew1178 commented on July 21, 2024

@DataTables

Hey Allan, is there a version which doesn't have this issue?

from scroller.

fbaligand avatar fbaligand commented on July 21, 2024

I reproduce the issue and I’m very interested by the fix !

As Andrew, to wait the fix, I’m interested by knowing which version doesn’t have this issue.

from scroller.

 avatar commented on July 21, 2024

Can you try the version that is available in git just now please? That should address the problem.

from scroller.

fbaligand avatar fbaligand commented on July 21, 2024

I just tried the very last version on master, but it didn't work :(
it is strange : I get classical pagination, instead of scrolling...
I'm based on official "Client-side data source (50,000 rows)".
BTW, the same example works great with version 1.4.4.

Here's my HTML code :

<html>

<head>

	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/scroller/1.5.1/css/scroller.dataTables.min.css">

	<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
	<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
	<script src="https://raw.githubusercontent.com/DataTables/Scroller/master/js/dataTables.scroller.js"></script>

	<script language="javascript">
		$(document).ready(function() {
        var data = [];
        for ( var i=0 ; i<50000 ; i++ ) {
            data.push( [ i, i, i, i, i ] );
        }
         
        $('#example').DataTable( {
            data:           data,
            deferRender:    true,
            scrollY:        200,
            scrollCollapse: true,
            scroller:       true
        } );
		} );
	</script>
</head>

<body>

	<table id="example" class="display nowrap" style="width:100%">
        <thead>
            <tr>
                <th>ID</th>
                <th>First name</th>
                <th>Last name</th>
                <th>ZIP / Post code</th>
                <th>Country</th>
            </tr>
        </thead>
    </table>
	
</body>
</html>

from scroller.

 avatar commented on July 21, 2024

from scroller.

fbaligand avatar fbaligand commented on July 21, 2024

Thank you for the tip.
I just tested it and it works better.
But it's still not perfect.
Compared to v1.4.4, there is still a regression : if I set scrollY: 600, I get this result (on Firefox, Chrome and IE11) :
image

from scroller.

 avatar commented on July 21, 2024

Thanks! I'll look into this can get back to you. I removed a draw after initialisation, and I think that will be the cause of this.

from scroller.

scsloan avatar scsloan commented on July 21, 2024

Having the same issue but with far less rows ~6,000. I am loading the data via ajax.

Scroller options:

            deferRender: true,
            scrollY: 600,
            scrollCollapse: true,
            scroller: {
                rowHeight: 40,
                boundaryScale: 0.5,
                displayBuffer: 3
            },

In testing, it looks like the issue is in how data tables is calculating the size of the the scroll body. I have found that I can get the strips to disappear if I do the following in firefox (latest version as of commenting)

  1. After table has been loaded with strips visible, Open developer tools (Ctrl+shift+K) so that it is docked to the bottom
  2. Scroll the data tables up and down while developer tools is open
  3. Close Developer tools,
  4. When you scroll strips will no longer appear

from scroller.

scsloan avatar scsloan commented on July 21, 2024

Further Investigations, the problems seems to be on on how prerow is calculated in _scroll() currently the nightly is doing.

var preRows =  Math.ceil( ((this.s.displayBuffer-1)/2) * this.s.viewportRows );

On initial load this creates a rather large preRow value. I found the problem is easily fixed if I just remove the multiplication and use

var preRows =  Math.ceil((this.s.displayBuffer-1)/2);

If this suits you, I can create a formal pull request.

from scroller.

BrotherErryn avatar BrotherErryn commented on July 21, 2024

+1 to this. Seeing the problem with 60k rows on server side. Info panel displays the correct visible rows, but Scroller doesn't seem to take the hint that it needs to load new records. I was in a position where I could only look at the minimized version, but it does definitely seem to be in the scroll function.

1.5dev does seem to work, but when it restores the prior scroll position you can't scroll back up to earlier records, so I can't use that even if I wanted to. Seems like an option to not save the scroll state would be nice.

from scroller.

nirshar avatar nirshar commented on July 21, 2024

I had similar issue with similar initialization (scroller plugin v2.0.0, client side).
I found the issue was on the 'init.scroller' listener where the measure( false ) called before the table was first render, therefor the viewport (clientHeight) was not set correctly and it was small number (19 in my case) and when devided by row.height (42) + 1 it just return 1, so what I got in: this.s.dt._iDisplayLength was 1 * this.s.displayBuffer,
but the scroller should trigger table redraw after many more rows.

I managed to fix it by changing the init.scroller to be:

		dt.on( 'init.scroller', function () {
			//that.measure( false );

			that._draw();
			that.measure( true );

			// Update the scroller when the DataTable is redrawn
			dt.on( 'draw.scroller', function () {
				that._draw();
			});
		} );

after the table was initially drawn it had the correct viewport and all the calculations were fine.

from scroller.

fbaligand avatar fbaligand commented on July 21, 2024

Thanks for info. Could you make a PR to fix the problem generally?

from scroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.