2014-04-10 1 views
2

검도 웹 UI 그리드 행을 편집하기 위해 편집 명령 링크를 사용하려고합니다. 문제는 모델에서 "# = Id #", id으로 정의되고 필드 중 하나 인 중 하나를 정의 할 수 없다는 것입니다. 당신이 볼 수 있듯이 그리드로드 내가 자바 스크립트 오류검도 UI 그리드 클라이언트 템플릿 "Id is not defined"

ReferenceError: Id is not defined 
#11 http://localhost:49713/Admin/SoftwareRequest/SoftwareRequestList:3 
#10 http://localhost:49713/Scripts/Kendo/kendo.web.js:294:22 eval (eval at() 
#9 http://localhost:49713/Scripts/Kendo/kendo.web.js:26361:44 Widget.extend._createButton() 
#8 http://localhost:49713/Scripts/Kendo/kendo.web.js:27571:38 Widget.extend._cellTmpl() 
#7 http://localhost:49713/Scripts/Kendo/kendo.web.js:27523:41 Widget.extend._tmpl() 
#6 http://localhost:49713/Scripts/Kendo/kendo.web.js:27624:37 Widget.extend._templates() 
#5 http://localhost:49713/Scripts/Kendo/kendo.web.js:25055:18 new Widget.extend.init() 
#4 http://localhost:49713/Scripts/Kendo/kendo.web.js:2785:25 HTMLDivElement.() 
#3 http://localhost:49713/Scripts/jquery-2.1.0.js:381:23 Function.jQuery.extend.each() 
#2 http://localhost:49713/Scripts/jquery-2.1.0.js:137:17 jQuery.fn.jQuery.each() 
#1 http://localhost:49713/Scripts/Kendo/kendo.web.js:2784:26 $.fn.(anonymous function) [as kendoGrid] 

에 따라 얻을 때 여기에서 스키마는 데이터 소스

var dataSource = new kendo.data.DataSource({ 
     type: "json", 
     ..... 
     schema: { 
      model: { 
       id: "Id", 
       fields: { 
        Id: { type: "number" }, 
        RequesterName: { type: "string" }, 
        ... 
       } 
      }, 
      data: "data", 
      total: "total" 
     }, 
     ... 
     pageSize: 5 
}); 

그리고 위의 코드와 검도 그리드

$("#request-grid").kendoGrid({ 
    dataSource: dataSource, 
    ... 
    columns: [{ 
     field: "Id", title: "Id", width: 35 
    }, { 
     field: "RequesterName", title: "Req Name", width: 175 
    }, { 
    ... 
    }, { 
     command: [{ name: "edit", template: "<a href='@Url.Action("_SoftwareRequestEdit", "SoftwareRequest")" + "/#= Id #" + "'>Edit</a>" }] 
    }], 
    ... 
}); 

에 정의되어 , 모델에 Id을 정의했지만 아직 받고 있습니다 ReferenceError : Id가 정의되지 않았습니다. 같은 단서.

답변

0

모델의 변수는 명령 열이 아닌 템플릿 열에서만 사용할 수 있습니다.

기본적으로 전체 template 열을 사용하여 목표를 달성 할 수 있지만 명령 열은 사용할 필요가 없습니다.

+0

나는 꽤 오랫동안 이것을 고심하고있다. 사실이 경우 템플리트 열은 멋지게 작동합니다. 큰. – Jatin

관련 문제