1
애플리케이션에있는 문제는 다음 웹 페이지를로드 할 때 마지막 라디오 버튼 세트 만 선택되어있는 동안 모든 라디오 버튼을 선택했기 때문입니다.생성 후 라디오 버튼을 동적으로 확인하십시오.
for(var i=0; i<results.rows.length; i++){
if(results.rows.item(i).qst_status==0) //OK
var x="<fieldset data-role='controlgroup' data-inline='true' data-type='horizontal'><input type='radio' name='radio-choice' id='radio-choice-1' value='OK' checked='checked' onclick='okpressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-1' style='width: 100px;'><img src='images/ok.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-2' value='KO' onclick='kopressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-2' style='width: 100px;'><img src='images/ko.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-3' value='NA' onclick='napressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-3' style='width: 100px; height:43px;'>N.A.</label></fieldset>";
else if(results.rows.item(i).qst_status==1) //KO
var x="<fieldset data-role='controlgroup' data-inline='true' data-type='horizontal'><input type='radio' name='radio-choice' id='radio-choice-1' value='OK' onclick='okpressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-1' style='width: 100px;'><img src='images/ok.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-2' value='KO' checked='checked' onclick='kopressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-2' style='width: 100px;'><img src='images/ko.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-3' value='NA' onclick='napressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-3' style='width: 100px; height:43px;'>N.A.</label></fieldset>";
else if(results.rows.item(i).qst_status==2) //NA
var x="<fieldset data-role='controlgroup' data-inline='true' data-type='horizontal'><input type='radio' name='radio-choice' id='radio-choice-1' value='OK' onclick='okpressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-1' style='width: 100px;'><img src='images/ok.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-2' value='KO' onclick='kopressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-2' style='width: 100px;'><img src='images/ko.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-3' value='NA' checked='checked' onclick='napressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-3' style='width: 100px; height:43px;'>N.A.</label></fieldset>";
else //Audit not completed
var x="<fieldset data-role='controlgroup' data-inline='true' data-type='horizontal'><input type='radio' name='radio-choice' id='radio-choice-1' value='OK' onclick='okpressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-1' style='width: 100px;'><img src='images/ok.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-2' value='KO' onclick='kopressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-2' style='width: 100px;'><img src='images/ko.png'></img></label><input type='radio' name='radio-choice' id='radio-choice-3' value='NA' onclick='napressed("+results.rows.item(i).qst_id+");'/><label for='radio-choice-3' style='width: 100px; height:43px;'>N.A.</label></fieldset>";
if(adt_status=="completed"){ //Audit completed
if(results.rows.item(i).chk_att==1) //Attachments
var v="<td width='10%' align='right'><a href='cameraroll.html' rel='external' onclick='updID("+results.rows.item(i).chk_id+");'><img src='images/ico/attach.png'></img></a></td>";
else //No attachments
var v="<td width='10%'></td>";
}
else{ //Audit not completed
if(results.rows.item(i).chk_att==1) //Ci sono allegati
var v="<td width='10%' align='right'><a href='#mediapopup' data-rel='popup' onclick='updID("+results.rows.item(i).chk_id+");'><img src='images/ico/attach.png'></img></a></td>";
else //No attachments
var v="<td width='10%' align='right'><a href='#mediapopup_noall' data-rel='popup' onclick='updID("+results.rows.item(i).chk_id+");'><img src='images/ico/attach.png'></img></a></td>";
}
t=t+"<tr><td colspan='2' width='90%'><p>"+results.rows.item(i).qst_sent+"</p></td><td width='10%' align='center'><a href='#notepopup' data-role='button' data-icon='info' data-rel='popup' onclick='updNote(\""+results.rows.item(i).qst_help+"\");' data-transition='pop' data-iconpos='notext'></a></td></tr><tr><td width='45%'>"+x+"</td><td width='45%'><textarea style='height:50px; width:100%' id='note' name='note' placeholder='Insert here notes' onchange='checkNote(this.value, "+results.rows.item(i).qst_id+")'>"+results.rows.item(i).qst_note+"</textarea></td>"+v+"</tr><tr><td colspan='3'><hr></td></tr>";
}
$("#checklisttable").append(t).trigger('create');
나는 사이클에 대한 내부 트리거 경우, 모든 것이 괜찮습니다하지만 훨씬 더 시간이 걸립니다 (나는주기 외부 트리거를 놓으면 십초에 대한 약 100 초)입니다. 어떻게 해결할 수 있습니까? http://jsfiddle.net/yeyene/dzckn/
먼저
은 그냥이 참고로, 당신은 하나 개의 요소에'id's를 할당해야합니다. 동일한 'id'를 여러 요소에 할당하려면 클래스를 대신 사용하십시오. –
그 방법 라디오 버튼이 작동하는 것은 그들이 동일한 이름을 가지고 있는지 모두 검사 할 수 없다는 것입니다. – kei
'$ ('[type = radio]') 각 라디오 (radio)를 통해 진행됩니다. 버튼을 눌러 확인하십시오. 그러나 각 그룹에서 하나의 라디오 만 검사됩니다. – Omar