使用bootstrap-select 动态加载数据不显示的问题,级联数据置为空

动态加载数据

                $.showLoading('数据加载中');//开启遮挡层
                $.ajax({
                    url: "/PickoutStock/GetSendReceive",
                    data: { n: no },
                    success: function (result) {
                        $.hideLoading();//关闭遮挡层
                        var result = $.parseJSON(result);
                        if (result.success == "false") return;
                        if (result.success) {
                            var option_send = "";
                            for (var i = 0; i < result.listSend.length; i++) {
                                option_send = $('<option value="' + result.listSend[i].K + '">' + result.listSend[i].V + '</option>');
                                $('#send_receive').append(option_send);
                            }
                            //刷新
                            $('#send_receive').selectpicker('refresh');
                            //渲染
                            $('#send_receive').selectpicker('render');
                        }
                    },
                    error: function () {
                        $.hideLoading();//关闭遮挡层
                        $.toast(result.Msg || '系统繁忙请稍后再试!', "text");
                    }
                })

在使用bootstrap-select 动态加载数据的时候,refresh和render方法是必须使用的

级联数据置为空

                        $("#storehouse").val("").trigger("change");//清空
                        $("#storehouse").html("");
                        //刷新
                        $('#storehouse').selectpicker('refresh');
                        //渲染
                        $('#storehouse').selectpicker('render');

猜你喜欢

转载自www.cnblogs.com/chenyanbin/p/12963160.html
今日推荐