Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am not getting placeholder in kendo dropdownlist.Can any one suggest me for solution

I am not getting placeholder in kendo dropdownlist. Can any one suggest me for solution

HTML

<input id="inp1" type="text"/>

JavaScript

var data1 = [ //this part is related to the above html tag
    {text: "org1", value: "1", color: "#a8a9aa", selected:true },
    {text: "org2", value: "2", color: "#000", selected: false },
    {text: "org3", value: "3", color: "#000", selected: false },
    {text: "org4", value: "4", color: "#000", selected: false },
    {text: "org5", value: "5", color: "#000", selected: false }
];
$("#inp1").kendoDropDownList({      
    dataTextField : "text",
    dataValueField: "value",
    dataSource    : data1,
    placeholder:"select your option",
    select        : onSelect,
    value         :1
});
like image 367
Gopi Krishnam Raju Avatar asked Dec 25 '22 01:12

Gopi Krishnam Raju


1 Answers

There is no "placeholder" property of kendo drop-down widget. Instead you can do that by placing an "optionLabel" property.i.e.

 var data1 = [ //this part is related to the above html tag
                 {text: "org1", value: "1", color: "#a8a9aa", selected:true },
                 {text: "org2", value: "2", color: "#000", selected: false },
                 {text: "org3", value: "3", color: "#000", selected: false },
                 {text: "org4", value: "4", color: "#000", selected: false },
                 {text: "org5", value: "5", color: "#000", selected: false }
            ];

   $("#inp1").kendoDropDownList({      
                  dataTextField : "text",
                  dataValueField: "value",
                  dataSource    : data1 ,
                  optionLabel   : "select your option",
                  select        : onSelect
           });

Make sure that "onSelect" function is defined in javascript. For reference check here.

like image 79
Satya Ranjan Sahoo Avatar answered Apr 26 '23 10:04

Satya Ranjan Sahoo