Jquery不使用剑道网格模板

Jquery不使用剑道网格模板,jquery,kendo-ui,kendo-grid,kendo-template,Jquery,Kendo Ui,Kendo Grid,Kendo Template,我试图使用Jquery和剑道网格模板内的控件,但Jquery不起作用,也不会出现任何错误 $("#grid").kendoGrid({ dataSource: { type: "json", transport: { read: { url: url, dataType: "

我试图使用Jquery和剑道网格模板内的控件,但Jquery不起作用,也不会出现任何错误

$("#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>
$(“#网格”).kendoGrid({
数据源:{
键入:“json”,
运输:{
阅读:{
url:url,
数据类型:“json”,
键入:“获取”,
}
},
页面大小:50
},
//身高:550,
分组:对,
可过滤:正确,
可排序:是的,
工具栏:kendo.template($(“#template”).html(),
可分页:{
刷新:是的,
页面大小:对,
按钮数:5
},
栏目:[{
字段:“applicaturefno”,
标题:“参考号”,
//宽度:200
}, {
字段:“名字”,
标题:“名字”
}, {
字段:“移动”,
标题:“手机”
}, {
字段:“地址”,
标题:“地址”
},
{
字段:“标记”,
标题:“考试成绩”
}]
});
}
拯救一切
$(文档).ready(函数(){
$(“#btnSaveAll”)。单击(函数(){
警报(“ff”);
}); 
});

我想说的是,问题在于在实际创建网格之前定义了
click
处理程序事件。可能吗

请在此处查看:

请尝试:

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

并检查警报是否显示消息BtnSave:1

您可以使用Jquery“on”方法对加载时间晚于绑定时间的DOM元素绑定事件

$("#btnSaveAll").on( 'click', function(e){
  alert("ff"); 
});
试试这个

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