我想創建一個下拉列表,該列表是根據在一組單選按鈕中進行的選擇動態填充的。我目前有一組單選按鈕名稱「適用性」,選擇的選項有:人員,程序,環境,交付能力,技術適航性和運營適航性。根據選擇哪一個,我希望下拉框中填充多個選項以供選擇。我目前使用的代碼是:單選按鈕選擇創建一個動態下拉列表
var peList = [「Worker Type」, 「Injury Type」];
var enList = [「Undefined」];
var prList = ["Facility", "Building", "Plant", "Damage Type"];
var caList = ["To Be Determined"];
var teList = ["Aircraft", "Component"];
var opList = ["Nothing at the moment"];
if (Applicability.rawValue===」People」) {
DropDownList4.clearItems;
for (var i = 0; i < peList.length; i++) {
DropDownList4.addItem(peList[i]);
}
} else if (Applicability.rawValue===」Property」) {
DropDownList4.clearItems;
for (var i = 0; i < prList.length; i++) {
DropDownList4.addItem(prList[i]);
}
} else if (Applicability.rawValue===」Environment」) {
DropDownList4.clearItems;
for (var i = 0; i < enList.length; i++) {
DropDownList4.addItem(enList[i]);
}
} else if (Applicability.rawValue===」CapabilityToDeliver」) {
DropDownList4.clearItems;
for (var i = 0; i < caList.length; i++) {
DropDownList4.addItem(caList[i]);
}
} else if (Applicability.rawValue===」TechnicalAirworthiness」) {
DropDownList4.clearItems;
for (var i = 0; i < taList.length; i++) {
DropDownList4.addItem(taList[i]);
}
} else if (Applicability.rawValue===」OperationalAirworthiness」) {
DropDownList4.clearItems;
for (var i = 0; i < opList.length; i++) {
DropDownList4.addItem(opList[i]);}
請問您可以通過向我展示我可能會出錯的地方來協助嗎?謝謝
您是否在某處出現錯誤?代碼看起來不錯 – tewathia
謝謝!它不會產生錯誤,它只是不起作用。我認爲這可能是沒有選擇正確執行選項的情況。我試過'點擊'和'initalise',但都沒有工作。你有什麼建議嗎?謝謝:) – mewisky