Create search input on cloned header but make other values empty

Create search input on cloned header but make other values empty

martin1223345martin1223345 Posts: 84Questions: 23Answers: 0

live.datatables.net/mowobugu/1/edit

In above test case I added search input boxes to colomn 0 and 3. But now the other colomns are showing the title of the original header that was cloned. How do I keep those titles empty and keep the titles in the search input boxes?

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    Use a jquery selector to choose the columns you want to clear the text using jQuery text() to clear the text value. This is specific to the 2nd column:

    $('#example thead tr:eq(1) th:eq(1)').text('')
    

    See this example:
    http://live.datatables.net/mowobugu/2/edit

    You may be able to workout a jjQuery selector to choose all the th tags that don't have input tags. Another option is to apply a class to the columns you don't want the search input and use that as the selector. Lots of options depending on what works best for your specific situation.

    Kevin

Sign In or Register to comment.