Buttons Extension not working with anchor tags?

Buttons Extension not working with anchor tags?

aajcaajc Posts: 1Questions: 1Answers: 0
edited September 2019 in Free community support

I'm using the buttons extension to add an anchor to the table. Whenever I click on the link, nothing happens. Below is the code

   $(document).ready( function () {
        $('#table').DataTable({
          // Customize data tables to add the "new item" button next to the listing option
          "lengthMenu": [ 10, 25, 50, 75, 100 ],
          dom:
          "<'row'<'col-sm-12 col-md-6'<'d-inline-block'l><'d-inline-block ml-md-4'B>><'col-sm-12 col-md-6'f>>" +
          "<'row'<'col-sm-12'tr>>" +
          "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
          buttons: {
            dom: {
              button: {
                tag: 'a href="/inventoryitems/create"'
              }
            },
            buttons: [
              {
                text: 'New Item'
              }
            ]
          }
        });
    });

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @aajc ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.