DataTable drawCallback Function for specific Table

DataTable drawCallback Function for specific Table

jdadwilsonjdadwilson Posts: 115Questions: 26Answers: 1

I use the following code in the drawCallback area to show/hide the paging info on a table. Works fine if only one table on the page. How do I change this if more than one table on the page?

function hide_pagingAreas ( thisApi ) {

    var tableInfo = thisApi.page.info();

    if (tableInfo.recordsDisplay <= tableInfo.length) {
        $('div.dt-paging').hide();
        $('div.dt-start').hide();
        $('div.dt-end').hide();
    } else {
        $('div.dt-paging').show();
        $('div.dt-start').show();
        $('div.dt-end').show();
    }
}

TIA for your assistance.
jdadwilson

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,856Questions: 85Answers: 409

    I couldn't find class "dt-paging", "dt-start" etc. on my pages.

    I assume you mean this when you speak about "paging info":

    If you do then you'd be looking at something different:

    Can you clarify please.

  • kthorngrenkthorngren Posts: 20,793Questions: 26Answers: 4,860
    Answer ✓

    Try using table().container(). Something like this:

    $( 'div.dt-paging', thisApi.table().container() ).hide();
    

    Kevin

  • kthorngrenkthorngren Posts: 20,793Questions: 26Answers: 4,860
    edited July 8

    @rf1234

    I couldn't find class "dt-paging", "dt-start" etc. on my pages.

    Those are new in DT 2.0 from the layout option.

    Kevin

  • jdadwilsonjdadwilson Posts: 115Questions: 26Answers: 1

    They are indeed there for v2.0 which is what I am using. The provided code works great.

    Thanks
    jdadwilson

Sign In or Register to comment.