在剑道网格中显示动态图像 [英] Displaying dynamic images in kendo grid

查看:131
本文介绍了在剑道网格中显示动态图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在剑道网格中填充动态图像. 我正在获取json数据.

I want to populate dynamic images in kendo grid. I am getting json data.

我有以下代码

 var grid = $("#timeSegmentGrid").kendoGrid({
    //var icon='';  
        dataSource: {
            transport: {
                read: function (options) {
                    getTimeSegmentList("", onSuccess, null);
                    function onSuccess(responseData) {
                        if (responseData.segments != null)
                            options.success(responseData.segments);
                        else
                            options.success([]);
                    }
                }
            },
            pageSize: 5
        },
        pageable: {
            input: true,
            numeric: false,
            pageSizes: false,
            refresh: true
        },
        toolbar: kendo.template($("#template").html()),
        columns: [
            { field: "display_name", title: "&{'Name'}" },
            { field: "display_order", title: "&{'Display Order'}" },
            { field: "icon",
                title: "Icon"
            }
        ]
    }).data("kendoGrid");

图标"包含图像的路径.现在,我可以打印路径了,但是我真的不知道如何根据该路径显示图像.任何帮助都将受到高度赞赏.

"icon" contains path to the image. Now, I am able to print the path but I really dont know how to display image according to that path. Any help is highly appreciated.

推荐答案

可以尝试:

columns : [
    { 
        field: "icon",
        title: "Icon",
        template: '<img src="#= icon #" alt="image" />'
    }
]

这篇关于在剑道网格中显示动态图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆