css – 在KendoUI网格列标题上添加Hovertext

前端之家收集整理的这篇文章主要介绍了css – 在KendoUI网格列标题上添加Hovertext前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试将自定义hovertext(如工具提示)添加到KendoUI网格中的列标题中.文本应特定于每列,理想情况下不显示标题行之外的任何内容上. Grid对象没有工具提示选项,但我不确定是否可以使用CSS或其 row template配置来执行此操作.

有兴趣听听是否有人之前已经这样做过,如果有的话,或者如果有可能的话.

谢谢.

解决方法

如果工具提示内容是静态的,那么您可以使用 columns.headerTemplate然后在标题添加 tooltip.

Example jsFiddle.

代码

$("#grid").kendoGrid({
    dataSource: {
        type: "odata",transport: {
            read: "http://demos.kendoui.com/service/Northwind.svc/Orders"
        },schema: {
            model: {
                fields: {
                    OrderID: {
                        type: "number"
                    },Freight: {
                        type: "number"
                    },ShipName: {
                        type: "string"
                    },OrderDate: {
                        type: "date"
                    },ShipCity: {
                        type: "string"
                    }
                }
            }
        },pageSize: 20,serverPaging: true,serverFiltering: true,serverSorting: true
    },height: 430,filterable: true,sortable: true,pageable: true,columns: [{
        field: "OrderID",filterable: false
    },"Freight",{
        field: "OrderDate",title: "Order Date",width: 120,format: "{0:MM/dd/yyyy}",headerTemplate: '<span title="This is the date the order was made.">Order Date</span>'
    },{
        field: "ShipName",title: "Ship Name",width: 260,headerTemplate: '<span title="The company the order was shipped to.">Ship Name</span>'
    },{
        field: "ShipCity",title: "Ship City",width: 150,headerTemplate: '<span title="The city the order was shipped to.">Ship City</span>'
    }]
});

$("#grid").kendoTooltip({
    filter: ".k-header span"
});

猜你在找的CSS相关文章