如何根据用户选择的下拉列表动态更改 Kendo Grid 主题。例如默认、银色、地铁、办公室蓝色主题等,如果将主题从默认更改为地铁网格颜色自动重新出现。任何人都可以帮助我。我对这个概念很陌生。
最佳答案
您可以在定义链接标签时,为其添加一个 id:
<link id="kendoStyle" href="~/Content/KendoUI/kendo.silver.min.css" rel="stylesheet" />.
然后将下拉列表的值设置为“~/Content/KendoUI/kendo.silver.min.css”和“~/Content/KendoUI/kendo.moonlight.min.css”和...
然后当用户在下拉列表中选择一个元素时,通过 id "kendoStyle"获取元素并将 href 设置为下拉列表的值。
像这样:
定义主题:
<link id="kendoStyle" href="~/Content/KendoUI/kendo.silver.min.css" rel="stylesheet" />
定义下拉列表:
<select id="style"><option value="">---</option>
<option value="~/Content/KendoUI/kendo.silver.min.css">silver</option>
<option value="~/Content/KendoUI/kendo.moonlight.min.css">moonlight</option>
</select>
动态改变主题:
$('#kendoStyle').attr('href',$('#style').val())
关于css - Kendo Grid 颜色动态变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23821820/