0
내 kendoUI가 파괴 방법을 사용하지 않습니까? 내가 도대체 뭘 잘못하고있는 겁니까. 그리드가 데이터를 제대로 표시하지만 레코드를 삭제하지 못합니다.KendoUI 그리드가 절대 파열되지 않습니다.
$("#registration-grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "@Html.Raw(Url.Action("List", "Participant"))",
type: "POST",
dataType: "json"
},
destroy: {
url: "http://localhost:53669/api/participant/",
type: "DELETE",
dataType: "json"
}
},
schema: { data: "Data", total: "Total", model: { id: "Id" } },
batch: false,
},
pageable: { ... },
editable: { mode: "inline" },
columns: [
{ field: "Id", title: "Id", width:50,filterable: false },
{ command: ["destroy"], title: " ", width: "250px" }
]
});
웹 API를 컨트롤러 참가자 : 피들러/API/참여자 테스트//이 작품
삭제 405 방법에 클릭이 허용되지[HttpDelete]
public HttpResponseMessage Delete(int id)
{
var participant = _participantService.Get(p => p.Id == id);
if (participant == null)
return Request.CreateResponse(HttpStatusCode.BadRequest);
try
{
_participantService.Delete(participant);
return Request.CreateResponse(HttpStatusCode.OK);
}
catch (Exception)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
}
KendoGrid 쇼 오류 삭제 요청 된 자원은 HTTP를 지원하지 않습니다 메서드 'DELETE'
컨트롤러에서 HttpPost로 동사를 변경하고 "POST"(html로 설정)를 시도해보십시오. 여기 예제 http://demos.telerik.com/kendo-ui/grid/editing – SBirthare
가장 저렴하고 저렴한 솔루션은 다음과 같습니다 : httpdelete 동사를 httppost 동사로 변경하십시오 – Amir