【问题标题】:Add new button in kendo grid edit popup mode在剑道网格编辑弹出模式中添加新按钮
【发布时间】:2013-01-12 21:25:27
【问题描述】:

我要添加一个按钮 kendo grid 编辑弹窗模式(kendo web asp.net mvc razor)

示例:我有 2 个表,关系为 one(table A) -many (table B) 现在用户单击添加新 B,在弹出编辑中有一个下拉显示 A,在下拉列表旁边我想添加新按钮以添加新 A 而无需直接导航

【问题讨论】:

    标签: asp.net-mvc kendo-ui


    【解决方案1】:

    在您的列定义中定义一个editor 函数,该函数生成两个元素(添加时的复选框和按钮)。

    例子:

    {
        field   : "selected",
        title   : "Selected",
        template: "<input type='checkbox' name='selected' #= selected ? 'checked' : '' # disabled/>",
        editor : generateButton
    }
    

    generateButton 是:

    function generateButton(container, options) {
        container.append('<input type="checkbox" name="' + options.field + '" data-type="boolean" data-bind="checked:' + options.field + '"/>')
                .append('<a href="#" id="mybutton" class="k-button">Button</a>');
    }
    

    JSFiddle 中的示例here

    【讨论】:

    • 感谢您的回复,但我使用 MVC,所以我怎么能像您一样 @(Html.Kendo().Grid(Model) .Name("Grid") .Columns(columns => { columns .Bound(p => p.PKiServiceID).Groupable(false).Visible(false); columns.Bound(p => p.SServiceName).Width(250); columns.Bound(p => p.BStatus)。 Width(70).ClientTemplate("#if(BStatus){# #='Y'# #} else {# #='N'# #}#"); columns.Command(command => { command.Edit( ); command.Destroy(); }).Width(200); }) ) )
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多