내가 세 수준의 계단식 아래계단식 드롭 다운 반복>
고객> 프로젝트 드롭이 작업
을 채워 프로젝트 난 그냥 프로젝트 작업
내가 가지고있는 OK
작업 프로젝트> 작업 (레벨 2 ~ 3)하지만 PIC 때 선택하려면 고객은 Project OK를 채우지 만 모든 프로젝트에 대해 Task를 다시 채 웁니다. 따라서 올바른 작업을 선택했지만 위의 3 가지 프로젝트가있는 경우 해당 작업을 3 번 채 웁니다
그래서 고객 A를 선택하면 프로젝트 1, 2, 3이 올바르게 채워지고 프로젝트 1이 기본값
으로 선택됩니다. 이 일을 왜 내가 볼 수있는 1 작업 2작업 1 작업 2 작업 : 프로젝트 1 가정
그러나이 작업 1과 작업 2를 가지고, 드롭 다운 태스크과 끝 그러나 나는 그것을 멈추는 법을 모르겠습니다.
/*
This java script is for CREATE and EDIT popup dialogs on the Task Index page
- Manage cascading drop downs (Client > Project, Project > Task)
- Synchronise check box with hidden field
*/
$(document).ready(function() {
//When Customer is changed reload Project
// Project function reloads project tasks
$("#Customer_ID").change(
function() {
// refresh projects
refreshProjectFromClient();
}
)
// When project is changed reload task
$("#CustomerProject_ID").change(
function() {
refreshProjectTaskFromProject();
}
)
// When chargeable is changed sync the hidden field
// A change in a checkbox called MyCheckBox_CB
// will be reflected in a hidden field called MyCheckBox
$(":checkbox").change(
function() {
$("#" + this.name.replace("_CB", "")).val((this.checked ? 1 : 0));
}
)
})
// This is called when the customer combo changes
// It reloads the project combo with the customers active projects
function refreshProjectFromClient() {
// clear drop down
$("#CustomerProject_ID").empty();
// Get new project dataset via ajax based on customer and populate drop down
$.ajax({
type: 'POST',
//url: '@Url.Action("GetProjects")',
url: window.location.toString() + '/GetProjects',
dataType: 'json',
data: { CustomerID: $("#Customer_ID").val() },
// success is called when dataset returns
success: function (p) {
// Populate with each returned member
$.each(p, function (i, pr) {
// is this append triggering the task onchange?
$("#CustomerProject_ID").append(
'<option value="' + pr.Value + '">' +
pr.Text + '</option>'
)
// now that it's loaded, load the project tasks
refreshProjectTaskFromProject();
})
}
});
}
function refreshProjectTaskFromProject() {
$("#CustomerProjectTask_ID").empty();
// Get new tasks dataset via ajax based on project and populate drop down
$.ajax({
type: 'POST',
url: window.location.toString() + '/GetProjectTasks',
dataType: 'json',
data: { ProjectID: $("#CustomerProject_ID").val() },
// success is called when dataset returns
success: function (t) {
// Populate with each returned member
$.each(t, function (i, ta) {
$("#CustomerProjectTask_ID").append(
'<option value="' + ta.Value + '">' +
ta.Text + '</option>'
);
})
}
});
}
OMG 너무 분명해서 내가 다시 테스트 해 보겠습니다. –
나는 올바른 위치로 함수를 옮겼습니다. 콜론을 추가하고 더 이상 채워지지 않습니다. 나는 결장이 정확하다는 것을 확신한다, 나는 다만 debugging javascript 힘든 –
를 찾아 낸다 동일한 URL에 배치하고 다른 응답을 얻고있다. > : –