Custom toolbar for two tables in a same page.

Custom toolbar for two tables in a same page.

sumnimasumnima Posts: 1Questions: 1Answers: 0

@section pagespecific {

$(document).ready(function () { $('#test').DataTable({ "dom": '<"toolbar">frtip' }); $('#EmailTable').DataTable({ "dom": '<"toolbar">frtip' }); $("div.toolbar").html('  Phone Number'); });

Answers

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    I don't really know what your question in I'm afraid. Perhaps you can link to a test case showing the issue, per the forum rules.

    Allan

  • VictorPearsonVictorPearson Posts: 16Questions: 1Answers: 0

    Hey Allen, I think sumnima is hitting the same issue I am...

    I want more than one DataTable on a page with each one having their own custom toolbar name.

    Each of my DataTables are in their own partial view.

    Yet when each are displayed on the same page, each get the toolbar name of the last one... not their own toolbar name.

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    That's related to the $("div.toolbar") selector - that will get all div elements with a toolbar class.

    If you want to limit it to a specific table you could use the table().container() method to get the container for a table - e.g.:

    $( 'div.toolbar', table.table().container() )...
    

    Allan

  • VictorPearsonVictorPearson Posts: 16Questions: 1Answers: 0

    Excellent! Thank you, Allan!

This discussion has been closed.