[英]AngularJS : Bootstrap typeahead with multiselect
我在我的角度應用程序中使用bootstrap multiselect。 (引導程序2.3)
http://davidstutz.github.io/bootstrap-multiselect/index-2-3.html#examples
我想將相同的內容轉換為提前引導,但用戶仍然可以在搜索結果中多選值。
我正在使用bootstrap typeahed的熒光筆功能將復選框添加到結果中。 我指的是這個plnkr http://plnkr.co/edit/szO2An1oslDyGftnshyR?p=preview,但是我仍然無法使我的代碼正常工作。
多選的舊代碼:
檢查最后選擇的值
$scope.selectOptions = function () { var index = fetching the index of checked values; var selectedAttrFound = index>-1; if (selectedAttrFound == true) { angular.element("#attr-value-selector") .multiselect('select', $scope.filterAttributes[index].attributeValues); } };
填充多選
$scope.attrValuesWidget = angular.element("#attr-value-selector") .multiselect({ numberDisplayed: 2, enableFiltering: true, maxHeight: "300", onChange: function (element, checked) { $scope.attributeActionValue = { attribute: $scope.attributeSelected, value: element.val(), checked: checked }; $scope.$apply(); } }) .multiselect('dataprovider', $scope.configAttributeValuesList);
選擇框
<select id='attr-value-selector' multiple='multiple' ></select>
盡管您可以輕松地在熒光筆功能中添加復選框。
highlighter: function( item ){
var bond = bondObjs[ item ];
return '<div class="bond">'
+'<input type="checkbox" class="mightBeRequiredToCollectTheSelectedResult">'
+'<img src="' + bond.photo + '" />'
+'<br/><strong>' + bond.name + '</strong>'
+'</div>';
}
問題是;
如果您查看typehead.js github問題頁面,則問題254提到他們至少暫時沒有計划支持多選。
現在,我可能對此表示不滿,但是如果我是您,我也會考慮其他選擇。
希望能幫助到你。 干杯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.