【发布时间】:2016-05-27 09:27:30
【问题描述】:
我有以下代码,它动态获取数据并将其推送到sumoselect。
<select id="geoSel_location_2">
</select>
<script type="text/javascript">
jQuery(document).ready(function() {
var returnSelect = jQuery('#geoSel_location_2');
returnSelect.SumoSelect({placeholder: 'All Suburbs'});
jQuery.getJSON("/cfcs/system.cfc?method=getSelectsRelated&returnformat=json&queryformat=column",{"type":"location","id":4,"index":2},function(res,code) {
if(res.ROWCOUNT > 0){
for(i=0; i<res.ROWCOUNT; i++){
var val = res.DATA.OPTION_VALUE[i];
var text = res.DATA.OPTION_TEXT[i];
returnSelect[0].sumo.add(val,text);
};
};
});
})
</script>
选项加载精美,但多选复选框未显示在每个选项旁边。我以为他们默认显示。
jsfiddle 是上述的简化版本。
【问题讨论】:
-
你能在
Jsfiddle复制这个吗?
标签: javascript jquery sumoselect.js