Kendo UI MVVM Dropdownlist - 下拉列表比控件本身宽

Kendo UI MVVM Dropdownlist - dropdown list wider than control itself

我有一个 Kendo UI MVVM 下拉列表,我希望列表的宽度比控件本身更宽。

<input class="dropDowns" data-role="dropdownlist" style="width: auto;" />

我找到了一个解决方案: Kendo UI Dropdown, making the drop down panel wider than the control 但我无法将其应用于我的 MVVM 示例。

显然你不能根据 class 设置列表宽度,你必须给它一个 id。

<input id="dropDowns" data-role="dropdownlist" style="width: auto;" />

然后 jQuery:

$("#dropDowns").data("kendoDropDownList").list.width(400);

另一种不使用 Id 的可能解决方案

$("[data-role=dropdownlist]").each(function () {
  $(this).data("kendoDropDownList").list.width(300);
});