부트 스트랩 ICheck는 변경된 이벤트를 수신 할 수 없습니다.
Dec 15 2020
라디오가 확인되었는지 여부에 따라 라디오 기반을 업데이트하는이 Jquery 코드가 있습니다. 그러나 이것은 실행되지 않습니다.
암호
this.init = function() {
$.ajax({ "url": "/cms/api/task_management/init", "contentType": "application/json", "dataType": "json", "type": "POST" }).done(function(map) { if ($("#title").val() || $("#problemCls").val() || $("#targetFunc").val() || $("#status").val() || $("#priority").val()) {
search();
} else {
callBackInit(map);
}
}).fail(failCallback);
$("input[type='radio']").on("ifChanged", function (event) { if ($("#display-method-unique").prop("checked")) {
renderDataTable(self.taskManagementList);
} else {
renderDataTable(self.allDataList);
}
}).iCheck({
radioClass: 'iradio_flat-green'
});
HTML
<div class="row">
<div class="col-md-4 col-sm-12 col-xs-12">
<div class="radio">
<input type="radio" name="display-method" id="display-method-unique" class="flat"><label for="display-method-unique">Doing</label>
<input type="radio" name="display-method" id="display-method-all" class="flat"><label for="display-method-all">End</label>
</div>
</div>
</div>
또한 클릭 기능 및 변경 기능에 대한 바인딩을 시도했습니다. 그러나 변경 이벤트는들을 수 없습니다. 그러나 둘 다 작동하지 않는 것 같습니다. Icheck.js 스크립트를 추가하지 않으면 모든 것이 잘 작동합니다.
아무도 부트 스트랩 Icheckhelper 클래스에서 변경된 이벤트에 연결하는 방법을 알고 있습니까?
답변
1 XinLiu Dec 16 2020 at 07:18
제대로 github의 포럼에서 대답 한 나는 유용 수정 프로그램을 발견 : 이 스레드에서 읽어 와 어떻게 핸들 라디오 이벤트에 iCheck - 도우미를 사용하는 경우?
그런 다음 코드를 변경했습니다. 문제가 해결되었습니다.
$("input[name='display-method']").iCheck({radioClass: 'iradio_flat-green'}); this.init = function() { $.ajax({
"url": "/cms/api/task_management/init",
"contentType": "application/json",
"dataType": "json",
"type": "POST"
}).done(function(map) {
if ($("#title").val() || $("#problemCls").val() || $("#targetFunc").val() || $("#status").val() || $("#priority").val()) { search(); } else { callBackInit(map); } $("input[name='display-method']").on("ifCreated ifClicked ifChanged ifChecked ifUnchecked ifDisabled ifEnabled ifDestroyed check", function (event) {
if ($("#display-method-unique").prop("checked")) {
renderDataTable(self.taskManagementList);
} else {
renderDataTable(self.allDataList);
}
});
}).fail(failCallback);
};