问题描述
我有三个下拉列表,一个列表填充在页面加载,并不会改变。第二和第三列表可以根据选择相应变化。此功能工作正常。
I have three drop down lists, one list is populated on page load and doesn't change. The 2nd and 3rd lists may change depending on the selection. This functionality is working fine.
我试图引导selectpicker添加到选择,我可以看到这是工作 - 不幸的列表不清爽根据选择。其实,我觉得幕后他们是我所看到的传递的查询,但通过前端没有任何反应。
I have tried to add Bootstrap selectpicker to the selectors and I can see it is working - unfortunately the lists are not refreshing based upon the selection. I actually think "behind the scenes" they are as I can see the queries being passed but via the front end nothing happens.
在HTML的部分:
<!-- SelectPicker -->
<link href='//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.2/css/bootstrap-select.min.css' rel='stylesheet' type='text/css'>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
前两个DDL的是通过PHP创建,但
The first two DDL's are created via php but are
<select id='ddl_first_lookup' onchange='ajaxFirstOnChange(this.value)' value='' class='selectpicker'></option>
<select id='ddl_second_lookup' onchange='ajaxSecondOnChange(this.value)' class='selectpicker'>
<select id="ddl_third_lookup" onchange='ajaxThirdLookup(this.value)' class='selectpicker'></select>
我有以下的Javascript:
I have the following Javascript:
$(document).ready(function() {
$(".selectpicker").selectpicker();
});
这是我发现了问题的地步,我想对改变功能的AJAX没有成功中实现这一点 - 即使不知道这是否是正确的。
This is the point where I have discovered the problem, I am trying to implement this within the ajax on change functions without success - not even sure if it is correct.
$('.selectpicker').selectpicker('refresh');
我是pretty的新的所有这一切所以想一些帮助。
I am pretty new to all of this so would like some help.
推荐答案
我发现有同样的问题后,你的问题。添加 $('selectpicker。')selectpicker('刷新');
之后完全将项目添加到我的清单做了工作
所以,你可能需要找到把它放在正确的位置。也许在你的Ajax调用成功的一部分。
I found your question after having the same problem. Adding $('.selectpicker').selectpicker('refresh');
exactly after adding items to my list did the job.
So you probably need to find the correct place to put it. Maybe in the success part of your ajax call.
这篇关于jQuery的引导selectpicker刷新列表基于previous列表选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!