이 스케줄러가 표시되지만 작업에 바인딩되지 않았습니다. 뷰의 스케줄러. 내가 읽기/웹 API를 아래검도 스케쥴러에 약속을 저장 한 후 다른 페이지로 이동
@(Html.Kendo().Scheduler<TaskViewModel>()
.Name("AppointmentSearchScheduler")
.DataSource(dataSource => dataSource
.Custom()
.Schema(schema => schema
.Model(m => {
m.Id(f => f.TaskID);
m.Field(f => f.OwnerID).DefaultValue(1);
}))
.Transport(new {
read = new Kendo.Mvc.ClientHandlerDescriptor() {
HandlerName = "customRead"
},
create = new Kendo.Mvc.ClientHandlerDescriptor() {
HandlerName = "customCreate"
}
})))
에 전화를 만들기 위해 자바 스크립트 방법을 사용하고하는 것은 내가 간결 처리기를 만들 포함하고 있지 않다 자바 스크립트 처리기 방법이다.
function customRead(options){
//get the selected Row of the kendo grid
var selectedRow = $("#locationgridKendo").find("tbody tr.k-state-selected");
var scheduler = $("#AppointmentSearchScheduler").data("kendoScheduler")
//get SelectedRow data
var rowData = $('#locationgridKendo').data("kendoGrid").dataItem(selectedRow);
if (rowData !== null) {
//Convert data to JSON
var rowDataJson = rowData.toJSON();
//extract the location ID
var locationId = rowDataJson.LocationID;
var CalenderweekStartDate = new Date().toISOString();
baseUrl = $('base').attr('href');
$.ajax({
url: baseUrl + 'Schedular/api/GetAppPerLocation?locationId=' + locationId + '&date=' + CalenderweekStartDate,
type: 'GET',
cache: false,
contentType: 'application/json',
success: function (result) {
//This method is hitting and i can see the data being returned
console.log('data is received : ' + result.Data);
options.success(result.Data);
},
error: function (xhr, status, error) {
//alert("Error: Search - Index.js - submitAppointment()");
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
}
});
}
}
다음은 ajax 호출을 통해 호출되는 웹 API 컨트롤러입니다. 컨트롤러는 기본 읽기/쓰기 구문을 사용할 때 완벽하게 작동합니다. 아약스 호출이 완료되면 성공 메소드를 다시 실행하여 데이터를 반환하지만 어떤 이유로 든 스케줄러가 들어오는 데이터에 바인드되지 않습니다. 다음은 내 컨트롤러 코드입니다.
[HttpGet]
[Route("api/GetAppPerLocation")]
public DataSourceResult GetAppointmentPerLocation([ModelBinder(typeof(Usps.Scheduling.Web.ModelBinders.DataSourceRequestModelBinder))] DataSourceRequest request, int locationId, DateTime date) {
List <TaskViewModel> locationAvailableAppointmentList = new List <TaskViewModel>();
locationAvailableAppointmentList = data.Select(appt => new TaskViewModel() {
TaskID = appt.ServiceAppointmentId,
Title = "Appointment Available",
Start = DateTime.SpecifyKind(appt.AppointmentBegin, DateTimeKind.Local),
End = DateTime.SpecifyKind(appt.AppointmentEnd, DateTimeKind.Local),
Description = "",
IsAllDay = false
}).ToList();
return locationAvailableAppointmentList.ToDataSourceResult(request);
}
어떤 이유로 인해 스케줄러가 들어오는 데이터에 바인딩되지 않습니다. 들어오는 데이터가 완벽하게 작동하지만 기본 바인딩 방식을 사용하지만 전송 기능은 사용하지 않습니다. 이 접근 방식을 사용하기위한 나의 목표는 일단 내가 읽기 (스케쥴러가 지금 바인딩되지 않음)로 끝났습니다. 생성시 컨트롤러에서 반환 한 새로 생성 된 작업의 ID를 가져온 다음 해당 ID를 다른 MVC 컨트롤러로 전달하여 렌더링해야합니다 확인 페이지. 이 목표를 달성하기위한 다른 접근 방법을 적극 권장합니다.
제발 나를 실수로 용서해주세요. 제 첫 번째 질문은 stackoverflow입니다.