如何在Kendo UI Grid中设置弹出编辑的密码模式

时间:2013-03-21 16:45:16

标签: kendo-ui kendo-grid

如何格式化Kendo网格弹出编辑对话框的密码输入字段以显示...等密码? 请帮忙。

3 个答案:

答案 0 :(得分:4)

我会稍微改变一下(对于Popup编辑器)。在构造html之后添加属性。

编辑: 我添加了如何添加工具提示的示例。

$(“#grid”).kendoGrid(
{
    …,
    edit: function( e )
    {
    //Add password attribute to input field.
        e.container.find( “.k-edit-field:eq(1) > input” ).attr( ‘type’, ‘password’ );

    //Add tooltip.
        e.container.find( "[data-label-for = name], [data-container-for = name]" ).attr('title', "One and two" ) );
    }
}

答案 1 :(得分:3)

editor函数添加到column定义,如下所示:

editor: function (container, options) {
    $('<input data-text-field="' + options.field + '" ' +
            'class="k-input k-textbox" ' +
            'type="password" ' +
            'data-value-field="' + options.field + '" ' +
            'data-bind="value:' + options.field + '"/>')
            .appendTo(container)
}

您甚至可以使用columns.hidden隐藏列,而不是在编辑模式下执行:

{
    hidden: true,
    field : "password",
    title : "Password",
    editor: function (container, options) {
        $('<input data-text-field="' + options.field + '" ' +
                'class="k-input k-textbox" ' +
                'type="password" ' +
                'data-value-field="' + options.field + '" ' +
                'data-bind="value:' + options.field + '"/>')
                .appendTo(container)
    }
} ,

答案 2 :(得分:0)

您可以使用属性标记属性,其中之一是; [DataType(DataType.Password)]。应用此选项后,您将获得一个“密码格式化”的控件,类似于下图。

enter image description here

有关信息,this question的答案让我知道如何做到这一点,也可能对某些人有用。

相关问题