Add blank select value to dropdown list

Add blank select value to dropdown list

ginacargileginacargile Posts: 17Questions: 3Answers: 0

I see there was a request for this functionality 11/15. If it hasn't been added, is there a workaround?
https://datatables.net//forums/discussion/31472

I've added this and the dropdown still just selects the first option in the list.
.SetFormatter(Format.IfEmpty(null))

Thanks!

Replies

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    You can do it on the client-side using the placeholder option of the -field select field type which was introduced in 1.5.4.

    Regards,
    Allan

  • ginacargileginacargile Posts: 17Questions: 3Answers: 0

    Are you saying like this? I tried it this way and it doesn't change anything. (no error either)

    {
    label: "Location:",
    name: "LocationID",
    type: "select",
    options: {
    placeholder: "--Select--"
    }

  • ginacargileginacargile Posts: 17Questions: 3Answers: 0
    edited August 2016

    Nevermind! I got it:

    {
    label: "Location:",
    name: "LocationID",
    type: "select",
    placeholderDisabled: false,
    placeholder: ""
    }

This discussion has been closed.