2013-10-01 3 views
0

에서 버튼 내가 지금 내부 그리드검도 UI 그리드 - 바닥 글

 var gridAwaitingForApproval = $("#gridAwaitingForApproval").kendoGrid({ 
      dataSource: dsAwaitingTimeSheets, 
      sortable: true, 
      pageable: true, 
      detailTemplate: kendo.template($("#awaiting-template").html()), 
      detailInit: detailInit, 
      dataBound: dataBound, 
      columns: [ 
       { 
        field: "Name", 
        title: "Name", 
        width: "120px" 
       }, 
       { 
        field: "Position", 
        title: "Position", 
        width: "120px" 
       }, 
       { 
        field: "Site", 
        width: "120px" 
       } 
      ] 
     }); 

     function dataBound() { 
      var grid = this; 

      //expand all detail rows 
      grid.tbody.find("tr.k-master-row").each(function() { 
       grid.expandRow($(this)); 
      }); 

      //remove hierarchy cells and column 
      $(".k-hierarchy-cell").remove(); 
      $(".k-hierarchy-col").remove(); 

     } 

     function detailInit(e) { 

      var detailRow = e.detailRow; 

      var grid = detailRow.find(".entries").kendoGrid({ 
       dataSource: 
       { 
        data: timeSheetEntries, 
        pageSize: 5, 
        filter: { field: "CandidateId", operator: "eq", value: e.data.CandidateId } 
       }, 
       columns: [ 
        { field: "CandidateId", title: "CandidateId", width: "56px" }, 
        { field: "Date", title: "Date", width: "56px" }, 
        { field: "MinutesWorked", title: "Minutes Worked", width: "56px" }, 
        { field: "MinutesBreak", title: "Minutes Break", width: "56px" }, 
        { field: "AbsenceDetails", title: "Absence Details", width: "56px" } 
       ] 
      }); 

이있는 검도 UI 그리드를 가지고, 그래서 내가 무슨 짓을했는지 APPEND입니다, 각 내부 그리드 뷰의 바닥 글에 명령 단추를 둘 필요가 호출기의 div에서 html

grid.find(".k-pager-info") 
       .append('<span class="approve" style="margin-left:2em;float:right;"><a class="btn-approve btn btn-primary btn-small">Approve</a></span>') 
       .delegate(".approve a", "click", function(e) { 
        console.debug(e); 
        alert("I NEED TO GET THE CandidateId IN HERE"); 
       }); 

내 문제는 어떻게 단추의 클릭 이벤트에서 특정 내부 격자의 데이터에 액세스 할 수 있습니까?

.delegate(".approve a", "click", function(e) { 
         console.debug(e); 
         alert("NEED TO ACCESS DATA OF THE GRID like CandidateId"); 
        }); 

어떻게 해결할 수있는 방법이 있습니까? 유연하지 않기 때문에 내장 도구 모음을 사용하지 않았습니다.

http://jsfiddle.net/lincx/BSQyd/79/

UPDATE : 지금 여기 임 ...

grid.find(".k-pager-info") 
       .append('<span class="approve" style="margin-left:2em;float:right;"><a class="btn-approve btn btn-primary btn-small">Approve</a></span>') 
       .delegate(".approve a", "click", function(e) { 

        var gridData = grid.data("kendoGrid"); 
        //var newrowdata = grid.dataItem(); 

        var selection = grid.select(); 
        console.debug(selection); 
        var rowData = gridData.dataItem(selection); // UNDEFINED 
        console.log(rowData.CandidateId);// UNDEFINED 
       }); 
+0

누구? 이 물건을 정리해야 해. – xlinc

답변

1

var selection = grid.select();var selection = gridData.select();해야한다.