使用javascript动态创建的kendo UI网格 [英] kendo UI grid created on fly using javascript

查看:63
本文介绍了使用javascript动态创建的kendo UI网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为操作链接"的网格列,它以JSON格式显示数据,如下所示:

I have one of the grid column called Action Links and it shows data as JSON format as follows:

  {"Id" : "1", "Flag1": "1", "Flag2": "1"}
    {"Id" : "2", "Flag1": "1", "Flag2": "1", "Flag3": "1"}
    {"Id" : "3", "Flag1": "1" }

我能够解析数据并获取所有标志和ID,但是现在的问题是,如果我看到"Flag1" = 1 ,那么在同一列动作链接"中,我需要替换数据以显示图像图标,然后使用" onclick "打开一个新窗口,其参数为Id = 1.

I am able to parse data and get all the Flags and Id's but my problem now is if i see "Flag1" = 1 then in the same column Action Links,i need to replace the data to show a image icon and "onclick" open a new window with parameter as Id = 1.

如果所有标志均为1,则显示3个不同的图标,然后单击打开带有相应参数ID的新窗口.我正在客户端执行此操作,因为这些字段是使用kendo UI和javascript动态创建的.

If all the flags are 1 then show 3 different icons and onclick open a new window with respective parameter id. I am doing it on client side as the fields are created on fly using kendo UI and javascript.

任何人都可以帮忙.

推荐答案

如果我正确理解,您希望您的kendo网格在特定列上有条件显示;如果是这样,则在您的网格声明中:

If I understood correctly you want your kendo grid to have a conditional display on a particular column; if so on your grid declaration:

... , {
           field: "Flag1",
           title: "Flag",
           template: function (dataItem) {
               var value = dataItem. Flag1;

               if (!value || value === 1) {
                   return 'image/html here';
               }
               return "something else";
           },

       }, { ..

Kendo Grid使用 template 函数有条件地在列中显示内容

Kendo Grid uses template function to conditionally display content in a a column

这篇关于使用javascript动态创建的kendo UI网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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