Server-side + Scroller not loading chunks of data

Server-side + Scroller not loading chunks of data

usedlensusedlens Posts: 15Questions: 5Answers: 1

The scroller seems to stop retrieving data for periods of time and you need to scroll further past a certain point to make it call via ajax again.

Here's a temporary URL to see the problem in action (I don't want search engines to pick this up)
https://usedlens.co.uk/index then add _temp.cfm

Here's a video demonstration
https://drive.google.com/file/d/1XCvibMFH9k4Nes8T4k9TU1Aua-r9lqNF/view

You can get an idea of my scrolling from the 'showing' results numbers.

                var resultsTable = $('#resultsTable').DataTable(
                    {
                        serverSide: true,
                        deferRender: true,
                        lengthChange: true,
                        scroller:true,
                        scrollY: 400,
                        scroller: {
                            loadingIndicator: true,
                            boundaryScale: 0.5,
                            serverWait: 50
                        },
                         'ajax': {
                            'url': 'data.cfc?method=dataTable',
                            data: function(data){
                                data.pricemin =  $('#pricemin').val();
                                data.pricemax =  $('#pricemax').val();
                                data.producttype = $("input[name='producttype']:checked").val();
                                data.shipto = $("input[name='shipto']:checked").val();

                                 if($('#hideEbay').is(':checked')){
                                        data.ebay = 1;
                                    } else {data.hideebay = 0;};
                                 if($('#showNew').is(':checked')){
                                        data.new = 1;
                                    } else {data.shownew = 0;};
                            },
                            dataSrc: function(json){
                                if(json.data)
                                    return json.data;
                                else
                                    return [];
                            },
                            type:'GET'
                         },
                         language: {
                                    searchPlaceholder: 'Search here - supports "exact" and -negative',
                                    search: ""
                        },
                         "fnDrawCallback": function( oSettings ) {
                                updateCopyLink();                               
                                if(resultsTable.page.info().recordsTotal == 0 && $("input[name='shipto']:checked").val() == 'local'){
                                    noLocalResults();
                                };
                        },
                        'search': {
                                search: '<Cfoutput>#replace(url.search, '''', '\''', 'all')#</cfoutput>'
                            },
                         'columns': [            
                            { 'data': 'productname' },
                            { 'data': 'price', render: function( data, type, row ) {
                                                if ($.isNumeric(data)) {
                                                    return $.fn.dataTable.render.number( '', '.', 2, '&pound;', '').display(data);
                                                } else {
                                                    return data;
                                                }
                                            }
                                            },
                            { 'data': 'retailersite' }
                         ],
                        'columnDefs': [
                           { "targets": [1,2], "searchable": false },
                           { "width":"10%","targets": [1]},
                           { "width":"20%","targets": [2]}
                         ]

                    }                   
                );

Answers

  • usedlensusedlens Posts: 15Questions: 5Answers: 1

    It also seems to jump an increasing number of records at times, I'll have a play with scroller parameters.

  • usedlensusedlens Posts: 15Questions: 5Answers: 1
    edited August 2020

    I've just discovered it's important that row height is kept the same, it's occurred to me this may not be very mobile phone friendly.

    I will revert to pagination for now

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    Hi,

    Thanks for the updates. I've just tried the link to see what was going on, but it is 404. However, if as you say the rows are not all of equal height, then yes that absolutely would be the issue. With Scroller the rows must be of equal height (so it can perform its virtual calculations).

    Pagination is generally much better for performance anyway!

    Allan

This discussion has been closed.