Pagination buttons re-appear - not wanted

Pagination buttons re-appear - not wanted

Dave333Dave333 Posts: 6Questions: 2Answers: 0
edited May 2021 in Free community support

Hello,

I have a datable which is initialised as follows:
(using jQuery)

$(".JrnlBtns").on('click', '.OpenBtn', function(e){

               $('#JrnlLinesTable').DataTable( {
                       data:           data,                       
                       scrollY:        '600px',
                       scrollCollapse: false,
                       scroller:       true,
                       searching:      false,
                       lengthChange:   false,
                       ordering:       false,
                                                        
                       drawCallback: function( settings ) {  
                          $('.JrnlSpec').removeClass('NoShow');
                      }
             } );
});

Works fine. Until..... the user changes an input value on one of the journal lines and i re-calculate the total amount of the journal that that input is in. Once the user changes the amount, my calculateTotals() function is called and the first thing that is executed there is:

var table = $('#JrnlLinesTable').DataTable();

I use this to get the DataTable data and use table.rows().every(function(rowIdx) { to get all the amounts of the lines and add them to my running total.

but once var table = $('#JrnlLinesTable').DataTable(); is executed, on the right of the DataTables the pagination buttons * and the search field re-appear, which is not wanted (i turned them off in the initialisation!).

  • next - [some page numbers] - previous

Why is this and how can i prevent them re-appearing? They are not needed nor wanted.....

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

Answers

  • kthorngrenkthorngren Posts: 20,145Questions: 26Answers: 4,736

    The behavior you describe doesn't sound correct. Sounds like a CSS issue but its hard to say without seeing the problem. Please post a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    I took your code snippets and built a test case which doesn't have the problem you described. Maybe you can update the test case to show the issue:
    http://live.datatables.net/bavupaga/1/edit

    Kevin

  • Dave333Dave333 Posts: 6Questions: 2Answers: 0

    Thanks for your reply and sorry that i haven't responded sooner. There was an urgent family matter so i couldn't. I'm sorry :-(

    I think i've resolved it. There was a css issue i initialised the DataTables twice, amongst some other small things that i've changed. Still learning DataTables, i guess :-)

    Thanks again, this issue may be closed now.

    have a great day!

This discussion has been closed.