2014-03-03 2 views
0

Kendo Grid에 인라인 삭제를 사용하고 있지만 조건을 확인한 다음 행을 삭제해야합니다.Kendo Grid에서 인라인 삭제 전에 행 값을 얻는 방법

function deleteRow(e) { 
    e.preventDefault ? e.preventDefault() : e.returnValue = false; 
    var grid = $("#documentListGrid").data("kendoGrid"); 
    if (confirm("Are you sure you want to delete the selected record(s)?")) { 

     grid.removeRow($(e.target).closest("tr")); 
    } else { 
     // cancel button is clicked 
    } 
} 

가 어떻게 행의 값을 얻을 조건을 확인합니까 :

@(Html.Kendo().Grid<DocumentSearchViewModel>() 
      .Name("documentListGrid") 
      .Columns(columns => 
       { 
        columns.Bound(model => model.AgentID).Title("Agent Code").Width("15%"); 
        columns.Bound(model => model.DocumentSecurityID).ClientTemplate("#if(data.AllowToView==1)" + 
                        "{ #<a class='lnkDocument' href='" + Url.Action("Download", "Document", new { fileName = "#=ScanFile#", fileLocation = "#=VC01#", batchTime = "#=BatchTime#", documentNumber = "#=CaseID#" }) + "' target='documentViewer'>#=data.BatchDescription#</a>#" + 
                        " " + " }" + 
                        "else{#<a class='disable-link' onclick='return Response();'>#=data.BatchDescription#</a> #}#").Title("Description").Width("30%"); 
        columns.Bound(model => model.CaseID).Width("10%").Title("Case#"); 
        columns.Bound(model => model.DocumentGroupID).Width("15%").Title("Group ID"); 
        columns.Bound(model => model.BatchNumber).Width("10%").Title("Batch#"); 
        columns.Bound(model => model.CreatedDate).Width("10%").Format(UI.DocumentSearchDateFormat).Title("Created Date"); 
        columns.Command(command => command.Custom("Remove").Click("deleteRow")); 
        columns.Bound(model => model.DocSystemID).Visible(false); 

       }) 
      .Pageable() 

      .Sortable(sortable => sortable.AllowUnsort(false)) 
      .DataSource(dataSource => dataSource 
             .Ajax() 
             .ServerOperation(false) 
              .Model(model => model.Id(p => p.CaseID)) 

             .Read(read => read.Action(WorkflowControllers.Document.ActionNames.GetDocumentList, WorkflowControllers.Document.Name, new { caseId = @Model.CaseID })) 
             .Events(ev => ev.Change("OnGridChange")) 

     ).AutoBind(true).Events(events => events.DataBound("DisplayDocument")) 
     ) 

Ajax 호출을 사용하여 컨트롤러 메서드를 호출 할 자바 스크립트 함수를 호출?

답변

0
$('#Grid').click(function() { 
    var gview = $(this).data("kendoGrid"); 
    var selectedItem = gview.dataItem(gview.select()); 
    var Guid = selectedItem.YourPropertName; 

}) 

selectedItem가이 모델의 속성이 모두있을 것이다

관련 문제