问题描述
我有一个初始化的selectMenu,后来我想用一些数据填充它:
I have a selectMenu that I initialized and later I want to populate it with some data:
$.each(data, function (Key, Value) {
$('#ddlReportFarms').append($("<option></option>")
.attr("value", Value.ID)
.text(Value.Name));
});
$('#ddlReportFarms').selectmenu('refresh', true);
由于某些原因,此方法不起作用,新项目不会显示.如果我这样做而不是刷新:
this doesn't work for some reason, the new items are not display.if I do this instead of the refresh:
$('#ddlReportFarms').selectmenu();
显示项目,但是再次发生时,selectMenu复制自身(出现两次)并变成越野车..
the items are displayed, but when this happens again,the selectMenu duplicates itself (appears twice) and becomes buggy..
有人吗?谢谢伊加尔(Igal)
anyone?thanksIgal
推荐答案
您使用哪个版本的selectmenu?
Which version of selectmenu do you use?
我的fork没有刷新方法,但是您的建议是正确的(也就是在已经初始化的selectmenu上使用selectmenu()来刷新它).请参阅Wiki以获取更多信息: https://github.com/fnagel/jquery-ui /wiki/Selectmenu
My fork has no method refresh but your proposal is correct (aka uing selectmenu() on a already initialized selectmenu to refresh it). Please see the wiki for more information: https://github.com/fnagel/jquery-ui/wiki/Selectmenu
这篇关于jQuery selectMenu刷新不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!