The problem I am facing is that during the first page load I want to read the value from cookies, if it is found, I want to change the theme that was saved in the cookie. not only want to change them, but I also want to select this element in the combo box so that it synchronizes with the ones that were applied.
How can I select a specific item while loading the start page, when I create a drop down box?
$(document).ready(function () {
var initialized = false;
var cmb=$(".themeChooser").kendoDropDownList({
dataSource: [
{ text: "Default" },
{ text: "BlueOpal" },
{ text: "Bootstrap" },
{ text: "Silver" },
{ text: "Uniform" },
{ text: "Metro" },
{ text: "Black" },
{ text: "MetroBlack" },
{ text: "HighContrast" },
{ text: "Moonlight" }
],
dataTextField: "text",
dataValueField: "value",
change: function (e) {
$.cookie('selectedTheme', theme);
changeTheme(theme);
}
});
theme = ($.cookie('selectedTheme') || "default").toLowerCase();
cmb.value(theme);
});
source
share