简体   繁体   English

如何在kendo网格的同一栏中添加锚点和按钮?

[英]How I can add anchor and button in same column of kendo grid?

I have a kendo grid where i want to add a link and a button in same column of kendo grid. 我有一个kendo网格,我想在kendo网格的同一列中添加一个链接和一个按钮。 When i add button into a grid column, my link from the template disappears from the column. 当我将按钮添加到网格列中时,模板中的链接将从列中消失。

My grid configuration: 我的网格配置:

subCategoryGrid: {
    sortable: true,
    height: 600,
    pageable: {
        previousNext: false,
        pageSizes: false
    },
    toolbar: [{
        template: kendo.template('<kendo-tabstrip><ul class="header-backGround"><li ng-class="{\'k-state-hover k-state-active\': defaultAllTab}"><a class="k-grid-add border"  ng-click="getAllSubCategories()">All</a></li>')
    }, {   
        template: kendo.template('<li ng-class="{\'k-state-hover k-state-active\': defaultPendingTab}"><a class="k-grid-add border" ng-click="getPendingSubCategories()">Pending Review</a></li>')
    }, {
        template: kendo.template('<li ng-class="{\'k-state-hover k-state-active\': defaultReviewTab}"><a class="k-grid-add border" ng-click="getReviewedSubCategories()">Reviewed</a></li></ul><kendo-tabstrip>')
    }],
    filterable: true,
    columns: [{
        template: '<strong><span ng-if="this.dataItem.sortCode === 1" class="text-success">NEW</span><span ng-if="this.dataItem.sortCode === 2" class="text-danger">!</span></strong>',
        width: '30px'
    }, {  
        template: kendo.template('<a ngMouseup="font-linksColor ng-class="\'k-state-hover k-state-active\'"" ng-click=\'fetchSubCategoryDetails(this.dataItem)\'>{{this.dataItem.subCategoryName}}</a>'),
        field: 'subCategoryName',
        title: 'Subcategory',
        width: '100px',
        command: [
              {
                  text: 'Details',
                  template: '<button class=\'k-button k-button-icontext\' ng-click=\'showDetail(this.dataItem)\'>Detail</button>',
                  title: 'Action',
                  width: '25px'
              },
          ],

    }, {
        field: 'status',
        title: 'Status',
        width: '65px'
    }]
},

You can't use the template and command option for a column at the same time; 您不能同时对列使用模板和命令选项; if you use the template, you need to create your button there, ie: 如果你使用模板,你需要在那里创建你的按钮,即:

template: kendo.template('<a> ...</a><button>...</button>'),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM