【问题标题】:How to set password mode for popup edit in Kendo UI Grid如何在 Kendo UI Grid 中为弹出编辑设置密码模式
【发布时间】:2013-03-21 16:45:16
【问题描述】:

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

【问题讨论】:

    标签: kendo-ui kendo-grid


    【解决方案1】:

    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】:

      我会做一些不同的事情(对于弹出编辑器)。在 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" ) );
          }
      }
      

      【讨论】:

        【解决方案3】:

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

        有关信息,this question 的答案给了我如何做到这一点的想法,并且可能对某些人也有用。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-11-27
          • 1970-01-01
          相关资源
          最近更新 更多