2014-11-12 5 views
0

버전 3.5.1을 사용하고 있습니다. 난 둘 다select2로 비활성화하면 작동하지 않습니다.

enable: false 

disable: true 

를 사용하여 시도했지만 둘 다 일 것 같다했습니다. 여기 내 코드 조각입니다.

var select2Node = $element[0].firstChild; 
    $(select2Node).select2({ 
    data: choices, 
    // Suppress the search box. 
    minimumResultsForSearch: -1, 
    allowClear: false, 
    width: '200px', 
    disable: true, 
    formatSelection: function(object, container) { 
     return $filter('truncateAtFirstInput')(object.id); 
    } 
    }); 

답변

1

Select2 생성자에 "사용"또는 "사용 안 함"옵션이 있다고 생각하지 않습니다. 대신 다음과 같이 "사용 설정"기능을 사용할 수 있습니다.

$(select2Node).select2({ 
    ... 
}).select2("enable", false);