2017-02-23 78 views
0

我有問題...我用這個link來改變局部視圖的視圖,但當改變局部視圖下拉沒有得到默認模板CSS我使用這個jQuery的刷新CSS:更改後部分觀點與jquery select picker沒有得到css

 $("#SelectPicker").selectpicker('refresh'); 
     $("#SelectPicker").selectpicker('render'); 

這段代碼的CSS是好,但使用後的下拉列表中無法打開此代碼 this is default dropdown template this is template of dropdown after change partial view

'code' function GetPartial() { 
    /* Get the selected value of dropdownlist */ 
    var selectedID = $("#EstateID").val(); 

    /* Request the partial view with .get request. */ 
    $.get('/Home/ReturnProSearchPartial/' + selectedID, function (data) { 

     /* data is the pure html returned from action method, load it to your page */ 
     $('#partialPlaceHolder').html(data); 

     $(document).ready(); 

     $(".SelectPicker").selectpicker('refresh'); 
     $(".SelectPicker").selectpicker('render'); 
    }); 


} 
+0

您需要顯示**您的代碼**。最好的猜測是你用'id =「SelectPicker」替換了元素,並且你沒有將插件附加到ajax成功回調中的新元素 –

回答

0

你只需要改變的DOM,這不意味着你的css setter調用被執行。您必須在DOM更新後再次執行它們。

+0

如何執行它們? –

+0

我使用MutationObserver檢測更改並執行我的method.Or - 超級醜陋的解決方案 - 使用setTimeout在100 ms後調用拾取器刷新。 – Dexion