Kendo ui 有没有办法向KendoUI网格中的文本字段添加占位符?

Kendo ui 有没有办法向KendoUI网格中的文本字段添加占位符?,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,我尝试使用以下代码将占位符属性添加到输入字段中: dataSource: { ... schema: { data: "storeEmployeeData", total: "storeEmployeeDataCount", model: { id: "ID", fields: {

我尝试使用以下代码将占位符属性添加到输入字段中:

    dataSource: {
        ...
        schema: {
            data: "storeEmployeeData",
            total: "storeEmployeeDataCount",
            model: {
                id: "ID",
                fields: {
                    Id: { type: "number", editable: false, nullable: true },
                    FirstName: { type: "string", nullable: true, editable: true, validation: { required: false } },
                    MiddleName: { type: "string", nullable: true, editable: true, validation: { required: false } },
                    LastName: { type: "string", nullable: true, editable: true, validation: { required: false } },
                    **Email: { type: "string", nullable: true, editable: true, placeholder: "(optional)", validation: { email: true, required: false } }
                }
            }
        },
        ...
    }
也试过下面的,

    columns: [
        { field: "FirstName", title: "First Name", type: "string", width: "150px" }, 
        { field: "MiddleName", title: "Middle Name", type: "string", width: "150px" }, 
        { field: "LastName", title: "Last Name", type: "string", width: "150px" }, 
        { field: "Email", title: "Email", type: "string", width: "250px", sortable: false, placeholder: "(optional)" }, 
        { command: ["edit", "destroy"], title: " ", width: "200px" }
    ],
它们都没有产生我想要的结果,即在输入字段中添加占位符属性
placeholder=“(可选)”

这是HTML5的一部分,如果这个功能已经存在于剑道UI网格中,它是否也与IE7和IE8兼容


我错过什么了吗?感谢您的帮助

剑道UI模型文档中没有
占位符
选项;因此,不直接支持它。参考文献:。也许你想使用
defaultValue

或者,您可以对剑道UI网格配置使用
属性
选项。参考文献:

占位符
属性仅在IE 10及更高版本中受支持

更新:(由于评论)

举个例子,为了向输入元素添加
占位符
属性,可以使用列上的
编辑器
选项

columns: [
  { field: "Email", title: "Email", width: 250, sortable: false, 
    editor: function (container, options) {
     var input = $("<input/>");
     input.attr("name", options.field);
     input.attr("placeholder", "(optional)");
     input.appendTo(container);
    }
  }
]
列:[
{字段:“电子邮件”,标题:“电子邮件”,宽度:250,可排序:false,
编辑器:函数(容器、选项){
变量输入=$(“”);
input.attr(“name”,options.field);
input.attr(“占位符”,“可选”);
输入。附加到(容器);
}
}
]

如果您在没有记录的情况下寻找占位符

   <div id="grid"></div>
    <script>
    $("#grid").kendoGrid({
      columns: [
        { field: "name" },
        { field: "age" }
      ],
      noRecords: true,
      dataSource: []
    });
    </script>

$(“#网格”).kendoGrid({
栏目:[
{字段:“名称”},
{字段:“年龄”}
],
诺雷科德:没错,
数据源:[]
});


$(“#网格”).kendoGrid({
栏目:[
{字段:“名称”},
{字段:“年龄”}
],
pageable:对,
诺雷科德:{
模板:“当前页上没有可用数据。当前页为:#=this.dataSource.page()#”
},
数据源:{
数据:[{姓名:“约翰”,年龄:29}],
页码:2,
页面大小:10
}
});

感谢Brett的快速回复,在向columnsAh添加属性:{“占位符”:“可选”}之后,它将占位符添加到td标记而不是输入标记,是的,没错。然后你必须做类似的事情:棒极了,删除属性并使用编辑器,谢谢Brett!我不明白你最后是怎么做到的?你能提供更多的信息吗?我有没有办法使用grid MVC helper为编辑器添加JS函数?
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  pageable: true,
  noRecords: {
    template: "No data available on current page. Current page is: #=this.dataSource.page()#"
  },
  dataSource: {
    data: [{name: "John", age: 29}],
    page: 2,
    pageSize: 10
  }
});
</script>