Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery KendoUI命令与KendoUI网格的模板问题_Jquery_Json_Jquery Ui_Kendo Ui_Kendo Grid - Fatal编程技术网

Jquery KendoUI命令与KendoUI网格的模板问题

Jquery KendoUI命令与KendoUI网格的模板问题,jquery,json,jquery-ui,kendo-ui,kendo-grid,Jquery,Json,Jquery Ui,Kendo Ui,Kendo Grid,我正在使用kendoUI web,而且是新手。我在下面的代码中遇到了一个问题 columns:[ { command:"edit", template:"<a href ='index_code.html' > #=edit# </a>", width: "80px", }, { field: 'edit', template: '<a href="index_code.html"&am

我正在使用kendoUI web,而且是新手。我在下面的代码中遇到了一个问题

columns:[
{
    command:"edit",
    template:"<a href ='index_code.html' > #=edit# </a>",
    width: "80px",
},
{
    field: 'edit',
    template: '<a href="index_code.html"> #=edit# </a&gt'
}]
当我单击field edit列时,它会将页面转移到index_code.html

但这不会发生在命令编辑列上,它不会执行任何操作


如何激活命令按钮???

不确定您想要实现什么,但:

  • 使用
    命令时
    不能使用
    模板
  • 定义
    命令时
    希望每个
    按钮
    都有相同的文本
  • 但是如果你想让它看起来像一个按钮,尽管它是一个链接,那当然可以使用
    template

    例如:

    columns   : [
        {
            field: 'edit',
            template: '<a href="index_code.html" class="k-button k-button-icontext"><span class="k-icon k-edit"></span>#= City #</a>',
            width: 100
        } 
    ]
    
    列:[
    {
    字段:“编辑”,
    模板:“”,
    宽度:100
    } 
    ]
    
    jshiddle here:

    像这样尝试

    columns:[
    {
         command:  "edit",
         width : 100
    },
    {
         field: 'edit',
         template: '<a href="index_code.html" class="k-button k-button-icontext"><span class="k-icon k-edit"></span>#= City #</a>',
         width: 100
    }]
    
    请参见此处的演示:

    $('.k-grid-edit').on("click", function () {
        alert('hi');
    });