0
이 나와 함께 많은 시간을 일이, 나는 그들의 대부분을 해결하기 위해 관리하지만, 여기에 또 다른 새로운 문제 :YII :
Checkboxlist를 사용하면 Ajax 작업 후 select all이라는 체크 박스가 있는데,이 상자를 클릭하면 다른 모든 체크 박스가 선택되지 않게됩니다. 그럼 어떻게 새로 고쳐야합니까?
<?php
$filterList = array(
'first' => 'first option',
'second' => 'second option',
'third' => 'third option',
);
$htmlOptions = array(
'checkAll'=>'Select All',
'separator' => ' ',
'template' => '{input} {label}<br/>'
// 'template' => '<tr><td >{label}</td><td>{input}</td></tr>'
);
echo CHtml::checkBoxList('filters', array('1'), $filterList, $htmlOptions)
?>
다음은 jQuery를
jQuery('#filters_all').click(function() {
jQuery("input[name='filters\[\]']").attr('checked', this.checked);
});
jQuery("input[name='filters\[\]']").click(function() {
jQuery('#filters_all').attr('checked', !jQuery("input[name='filters\[\]']:not(:checked)").length);
});
jQuery('#filters_all').attr('checked', !jQuery("input[name='filters\[\]']:not(:checked)").length);
내가 통해 UR 관심을 가져 주셔서 감사합니다 당신의 가정을 이해하지 못했다 원인, 생성 된 jQuery 코드를 추가하면 더 기반으로 정교한 수 있기를 희망했습니다 그 편집 –