SearchPane resets scroll position after selection

SearchPane resets scroll position after selection

aluionescualuionescu Posts: 3Questions: 1Answers: 0
edited March 4 in Free community support

Thank you for such a useful tool that is the Datatables library.

I created a two column SearchPane using data from the Server-Side and the cascadePanes set to true.

All seem to go well expect that whenever I make a selection in one of the panes, instead of the natural maintaining of the scroll position, I always get a reset and scroll to the top of the pane.

Searching the forum, I see at least one person that has the same issue (https://datatables.net/forums/discussion/comment/219981) and it looks like the example in the Editor (https://editor.datatables.net/examples/extensions/searchPanesCascade.html) is experiencing the same problem.

Could there be an easy fix to maintain the scroll position?

I use the latest version of Datatable (2.0.1) / SearchPanes (2.3.0) / Select (2.0.0) (

Thank you,

Answers

  • aluionescualuionescu Posts: 3Questions: 1Answers: 0

    This is how the basic initialization looks:

    var table = $('#myTable').DataTable({
                processing: true,
                responsive: true,
                serverSide: true,
    
                ajax: {
                    url: 'get-data.php',
                    data: function(d) {
    
                        //  DataTables params request
                        d.search = d.search.value;
                        d.start = d.start;
                        d.length = d.length;
                        if (typeof d.order === 'undefined' || d.order.length === 0) {
                            // Set initial ordering (by score from the server)
                            d.order = [{
                                column: 0,
                                dir: 'asc'
                            }];
                        } else {
                            d.orderColumn = d.order[0].column;
                            d.orderDir = d.order[0].dir;
                        }
                        d.formSearch = initialSearchValue;
                        d.tinut = initialJudetValue;
                        d.sursa = initialSursaValue;
    
                    },
                    dataType: 'json',
                    type: 'GET',
                },
    
                "columnDefs": [
                {
                    searchPanes: {
                        show: true,
                        className: 'filter-table'
                    },
                    targets: [2,3]
                },
                ],
    
                layout: {
                    top1: {
                        searchPanes: {
                            orderable: true,
                            initCollapsed: true,
                            cascadePanes: true,
                            // dtOpts: {
                            //     select: {
                            //         style: 'multi',
                            //     },
                            // }
                        }
                    }
                },  
        }
    
Sign In or Register to comment.