지금까지 kendogrid를 인스턴스화하고 내 뷰 모델의 값을 전달하려고합니다. vb.net에 대한 Telerik의 설명서에서 다음 코드를 얻었습니다. 문제는 .Grid -> "(T)의 그리드 빌더 인 public override 할 수있는 오버로드 함수 격자 (T)의 유형 매개 변수는 유추 될 수 없습니다."검도 그리드를 통해 뷰 모델의 데이터를 컨트롤러로 전달
Html.Kendo .Grid(). 이름 ("kendogrid")
이 오류의 의미를 모르거나 수정 방법을 모르겠습니다.
보기
$(document).ready(function() {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "TestAjax",
dataType: "json",
type: "GET",
},
update: {
url: "update",
dataType: "json",
type: "POST"
},
create: {
url: "CreateInvoiceRecord",
dataType: "json",
type: "GET",
},
parameterMap: function (options, operation) {
console.log(operation);
console.log(options);
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
batch: true,
pageSize: 20,
schema: {
model: {
id: "itemID",
fields: {
ItemName: { type: "string" },
Amount: { type: "number", editable: false, validation: { required: true } },
ProductLine: { type: "string" },
Status: { type: "string" },
}
}
},
aggregate: [{ field: "Amount", aggregate: "sum" }
]
});
$("#kendogrid").kendoGrid({
DataSource: dataSource,
pageable: true,
height: 550,
toolbar: ["create", "save"],
columns: [
{ field: "ItemName", title: "Item", width: "150px" },
{ field: "Amount", title: "Amount", format: "{0:c}", width: "100px", aggregates: ["sum"], footerTemplate: "Total Amount: #=sum#" },
{ field: "ProductLine", title: "Product Line", width: "150px", editor: productLineDropDownEditor},
{ field: "Status", title: "Status", width: "150px", editor: statusDropDownEditor },
{ command: "Update", title: "Update" , width:"150px"}],
editable: true
});
});
모델
Public Class MyViewModel
Public Property id As String
Public Property id2 As String
End Class
당신은 당신의 컨트롤러가 그리드의 읽기 방법에 반환 모델 목록 잘되어 있는지 확인해야합니다. 예를 들어, 열이 "name", "age", "sex"이면 제어기의 모델은 정확히 "name", "age", "sex"와 대소 문자를 구분해야합니다. –
나는 이해하고 있는지 잘 모르겠다. 모범을 보이거나 좀 더 깊이 들어갈 수 있습니까? 어쨌든 도움이된다면 검도 코드도 추가했습니다. – Monika