2014-07-23 2 views
0

Kendo Grid Template 내 컨트롤에서 Jquery를 사용하려고하지만 jquery가 작동하지 않으며 오류도 발생하지 않습니다.Jendery가 Kendo Grid 템플릿과 함께 작동하지 않습니다.

$("#grid").kendoGrid({ 
      dataSource: { 
       type: "json", 
       transport: { 
        read: { 
         url: url, 
         dataType: "json", 
         type: "GET", 

        } 
       }, 
       pageSize: 50 
      }, 
      //height: 550, 
      groupable: true, 
      filterable: true, 
      sortable: true, 
      toolbar: kendo.template($("#template").html()), 
      pageable: { 
       refresh: true, 
       pageSizes: true, 
       buttonCount: 5 
      }, 
      columns: [{ 
       field: "ApplicantRefNo", 
       title: "Reference No.", 
       //width: 200 
      }, { 
       field: "FirstName", 
       title: "First Name" 
      }, { 
       field: "Mobile", 
       title: "Mobile" 
      }, { 
       field: "Address", 
       title: "Address" 
      }, 
      { 
       field: "Marks", 
       title: "Test Score" 
      }] 
     }); 
    } 

<script type="text/x-kendo-template" id="template"> 
       <div class="toolbar"> 

        <a id="btnSaveAll">Save All</a> 

       </div> 

</script> 

<script> 

    $(document).ready(function() { 

     $("#btnSaveAll").click(function() { 
         alert("ff"); 
      }); 
     }); 
</script> 

답변

1

이 시도 ..

$(document).on("click","#btnSaveAll", function(e){ 
    alert("ff"); 
}); 

감사

0

그리드가 실제로 생성되기 전에 click 처리기 이벤트를 정의하는 것이 문제라고 말할 수 있습니다. 가능한가?

여기를 확인하십시오 : 메시지 BtnSave를

$(document).ready(function() { 
    alert("BtnSave : " + $("#btnSaveAll").length); 
    $("#btnSaveAll").click(function() { 
    alert("ff"); 
    }); 
}); 

을 그리고 경고가 표시되는지 확인합니다 : http://jsfiddle.net/OnaBai/8U6rg/5/

시도하십시오 1

0

당신은 바인딩하는 방법 '에'jQuery를 사용할 수 있습니다 바인딩되는 것보다 나중에로드되는 DOM 요소에 대한 이벤트입니다.

$("#btnSaveAll").on('click', function(e){ 
    alert("ff"); 
}); 
관련 문제