을 정의되지 않는다 :selectToUISlider 오류 selectOptions는 [optIndex] 그래서 나는이 기능을 가지고
function load_question_div(render_to, question_info){
//alert(question_info);
var answertype = question_info['question']['answer_type'];
//var allow_graph = question_info['show_graph'];
var responseoptionset = question_info['response_option_set'];
var range = question_info['range'];
var labels = question_info['labels'];
var choices = question_info['choices'];
var questiondiv = $("#samplequestiondiv").clone();
$(questiondiv).attr("id", "question-div");
var questionform = $(questiondiv).children('form')[0];
$(questionform).attr('id', "question_form");
var questiontitle = $(questiondiv).children('p')[0];
$(questiontitle).text(question_info['question']['title']);
if(answertype == "slider"){
var sliderdiv = document.createElement('div');
$(sliderdiv).attr('id', "slider");
$(sliderdiv).attr('style', "padding-top:1.5em;padding-right: 1em;padding-left:.5em;overflow: visible;");
$(questionform).append(sliderdiv);
for(var i=0; i<responseoptionset.length; i++){
alert(responseoptionset[i]['id']);
var qinput = document.createElement('div');
$(qinput).addClass("question_input");
$(qinput).attr("style", "text-align:center; margin-bottom:40px;padding-left:10px;");
var inputlabel = document.createElement('label');
$(inputlabel).text(responseoptionset[i]['text']);
var inputselect = document.createElement('select');
$(inputselect).attr('name', 'r'+responseoptionset[i]['id']);
$(inputselect).attr('id', 'slider'+responseoptionset[i]['id']);
for (var v=0; v< range.length; v++){
var inputoption = document.createElement('option');
$(inputoption).addClass("question_input");
$(inputoption).attr('value', range[v]);
$(inputselect).append(inputoption);
}
$(qinput).append(inputlabel);
$(qinput).append(inputselect);
$(questionform).append(qinput);
alert("ok");
$('#slider'+responseoptionset[i]['id']).selectToUISlider({tooltip: false, labels: labels}).hide();
alert("done");
}
이 기능은, 선별를 생성 옵션을 만든 다음 selectToUISlider를 만들 예정이다. 마지막 경고 바로 직전에 "변환"문을 주석 처리하면 모든 것이 예상대로 나타납니다. 내가 그것을 떠날 때, 추가가 작동하지 않습니다.
또한, 나는 그것을 떠날 때 아무것도 나타나없고 불을 지르고는 나에게 오류 제공 :
selectOptions [optIndex]가 (범위 10에서 75)
[이 오류에 브레이크] 정의입니다
나는 75와 10의 출처를 모르지만, 슬라이더의 범위와 상관없이 항상 75와 10입니다.
내 모든 변수가 올 바르고 정답입니다. jquery가 아니라 django 템플릿 태그를 사용하여 요소를 만드는 것을 제외하고는 거의 동일한 방식으로이 작업을 수행했습니다.
내가 jQuery를 1.6.2 및 jQueryUI 1.8.16을 사용하고
사람이 문제를 볼 수 있습니다 (I이었다로 작동 할 때)? 아니면 이전에이 문제를 겪은 사람이 있습니까?
편집 : 함수 호출하지 않고, 같은 선택 외모에 대해 생성 된 소스 (나는 선택이 전혀 표시 얻을 수있는 유일한 방법입니다) : 작동 어떤 이유로
<div style=
"padding-top: 1.5em; padding-right: 1em; padding-left: 0.5em; overflow: visible;" id=
"slider"></div>
<div style="text-align: center; margin-bottom: 40px; padding-left: 10px;" class=
"question_input">
<label>--</label>
<select id="slider759" name="r759">
<option text="1" value="1" class="question_input">
1
</option>
<option text="2" value="2" class="question_input">
2
</option>
<option text="3" value="3" class="question_input">
3
</option>
<option text="4" value="4" class="question_input">
4
</option>
<option text="5" value="5" class="question_input">
5
</option>
</select>
</div>
궁금한 점이 있습니다 : 옵션의 텍스트 필드를 설정하는 경우 문제가 해결 되겠습니까? –
내 오류 메시지를 없애 버렸지 만 이제는 내 선택이 나타나지 않습니다. – Colleen
소스를보고 선택 항목 중 하나에 대해 결과 HTML을 표시 할 수 있습니까? –