How to make headers link with datatable?

How to make headers link with datatable?

LeonKLeonK Posts: 13Questions: 5Answers: 1

How can I add href link to the header column titles with the datatable? I use no ordering and do not need sorting behavior.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    You should be able to simply put an <a ..>...</a> tag in the header cell. Have you tried that?

    Allan

  • LeonKLeonK Posts: 13Questions: 5Answers: 1

    Yes I did. But after initialization of datatable the references gone.

     $('#info01').DataTable({
                   sAjaxDataProp: 'data',
                   ajax: '/p/16/info',
                   columns: [{"data":"account_4","title":"Account","link":"/a/4"},...],
                   paging: false,
                   searching: false,
                   ordering: false,
                   info:false
                 });
    
    
    <table id="info01" >
            <thead>
              <th>
                <a href="/a/4">Account</a>
              </th>
    
  • LeonKLeonK Posts: 13Questions: 5Answers: 1
    edited February 2016 Answer ✓

    I found. I should not use title key in the columns array. If the key presents then in will replace the content of the header.

    Solved. Thanx ))

This discussion has been closed.