I have used Kendo Dropdownlist , to display information in list. Here my requirement is to add the bellow mention styles i.e. (.k-list-container and .k-list-scroller ) to Dropdownlist using JavaScript.
And make the height of ".k-list-scroller" dynamic i.e. the drop down list-area when selected, the height of it, should go beyond screen height or window height. In this case i have hard coded (height: 500px !important;).
.k-list-container{ width: auto !important; height: auto !important; } .k-list-scroller{ height: 500px !important; overflow-y: scroll !important; }
The bellow code example is for reference -
<style> .k-list { white-space: nowrap; } .k-list-container{ width: auto !important; height: auto !important; } .k-list-scroller{ height: 500px !important; overflow-y: scroll !important; }</style><div id="example"> <p> data: <select id="local"></select> </p></div><script> $(function() { var data = [ { text: "Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey ", value: "13" }, { text: "Black 1", value: "1" }, { text: "Orange 2", value: "2" }, { text: "Black 3", value: "3" }, { text: "Orange 4", value: "4" }, { text: "Black 5", value: "5" }, { text: "Orange 6", value: "6" }, { text: "Black 7", value: "7" }, { text: "Orange 8", value: "8" }, { text: "Black 9", value: "9" }, { text: "Orange 10", value: "10" }, { text: "Black 11", value: "11" }, { text: "Orange 12", value: "12" }, { text: "Black 1", value: "1" }, { text: "Orange 2", value: "2" }, { text: "Black 3", value: "3" }, { text: "Orange 4", value: "4" }, { text: "Black 5", value: "5" }, { text: "Orange 6", value: "6" }, { text: "Black 7", value: "7" }, { text: "Orange 8", value: "8" }, { text: "Black 9", value: "9" }, { text: "Orange 10", value: "10" }, { text: "Black 11", value: "11" }, { text: "Orange 12", value: "12" }, { text: "Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey Grey ", value: "13" }, { text: "Black 1", value: "1" }, { text: "Orange 2", value: "2" }, { text: "Black 3", value: "3" }, { text: "Orange 4", value: "4" }, { text: "Black 5", value: "5" }, { text: "Orange 6", value: "6" }, { text: "Black 7", value: "7" }, { text: "Orange 8", value: "8" }, { text: "Black 9", value: "9" }, { text: "Orange 10", value: "10" }, { text: "Black 11", value: "11" }, { text: "Orange 12", value: "12" }, { text: "Black 1", value: "1" }, { text: "Orange 2", value: "2" }, { text: "Black 3", value: "3" }, { text: "Orange 4", value: "4" }, { text: "Black 5", value: "5" }, { text: "Orange 6", value: "6" }, { text: "Black 7", value: "7" }, { text: "Orange 8", value: "8" }, { text: "Black 9", value: "9" }, { text: "Orange 10", value: "10" }, { text: "Black 11", value: "11" }, { text: "Orange 12", value: "12" } ]; $("#local").kendoDropDownList({ dataTextField: "text", dataValueField: "value", dataSource: data, }); }); </script></body></html>Thanks