简体   繁体   English

在Kendo UI Grid的数据源列中加载图像

[英]Loading Image in a column of datasource in Kendo UI Grid

EDIT: SOLVED WHen i removed the ~ symbol from the path it loaded properly. 编辑:解决了我从正确加载的路径中删除了〜符号。 I have a Kendo UI grid and it shows up the data from a datasource. 我有一个Kendo UI网格,它显示了数据源中的数据。 However the column which is supposed to show an image does not show up. 但是,本应显示图像的列未显示。 It shows as X mark. 它显示为X标记。

When I put the html img tag separately in the document i can see the image in the browser. 当我在文档中单独放置html img标签时,我可以在浏览器中看到图像。 ANy idea what I am doing wrong. 知道我在做什么错。

$("#eventsgrid").kendoGrid({
                            dataSource: expensesDataSource,
                            navigatable: true,
                            pageable: {
                                input: true,
                                numeric: false
                            },
                            columns:[
                            {
                                field:"CardNumber"
                            },
                            {
                                field:"Description"
                            },
                            {
                            title: "Image", template: '<img src="~/Content/Themes/Default/images/Door.jpg" width="60" height="80"/>'
                            }
                                ]
                        }).data("kendoGrid");

Try defining the field as well: 也尝试定义字段:

field: "Image", title:"Image", template: '<img src="~/Content/Themes/Default/images/Door.jpg"'

If that works, then add back in the sizing parameters. 如果可行,则重新添加大小参数。

为什么我从正确加载的路径中删除了〜符号。

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

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