Placeholder in input search control

Placeholder in input search control

sloloslolo Posts: 117Questions: 24Answers: 2

Link to test case: NA
Debugger code (debug.datatables.net): NA
Error messages shown: NA
Description of problem: Hello,

Can you tell me if it is possible to display in the HTML input text field of the columnControl component a specific placeHolder or one that would take the title of the column to which it is attached?

Thanks in advance for your answer and have a nice day.

Lolo

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,162Questions: 1Answers: 10,796 Site admin

    Hi Lolo,

    Yes, you can use the placeholder option for the various search content types. As the docs say, use [title] if you want it to show the column title, or you can do Search [title]... etc.

    Allan

  • sloloslolo Posts: 117Questions: 24Answers: 2

    Hi @allan,

    I ma not sure to understand the way to use the option.

    I have done a small test case if you want to have a look.
    https://live.datatables.net/saqeyumi/1/edit

    I was able to "extend" the "search" functionality but not like I really want.

  • allanallan Posts: 65,162Questions: 1Answers: 10,796 Site admin

    You'll need to explain to me what you do want then, since you have the placeholder option being set to bar, wchi is appearing as the placeholder for the search inputs:

    Allan

  • sloloslolo Posts: 117Questions: 24Answers: 2

    Actually, I just want the text box placeholder to automatically take the value of the column title.

    Like this:

  • allanallan Posts: 65,162Questions: 1Answers: 10,796 Site admin
    Answer ✓

    Use [title] like I mentioned above in that case: https://live.datatables.net/saqeyumi/2/edit .

    Allan

  • sloloslolo Posts: 117Questions: 24Answers: 2

    Thanks a lot @allan,

    It works very well :)

    Sorry, I didn't quite understand how to use the property.
    Now that I see the solution, I understand the documentation better.

    Besides, it's not trivial that we have to use (and not documented on the link you gave me):
    { extend: "search", placeholder: "[title]", },

    Luckily I had already used this syntax for buttons so I was inspired by it :)

Sign In or Register to comment.