【发布时间】:2016-01-23 04:57:54
【问题描述】:
我们有一个内部工具,用于将用户批量添加到我们的数据库中。为此,用户将上传一个 CSV 文件,该文件在客户端读取并显示在 Kendo Grid 中。
我正在尝试实现某种形式的验证,将集合推送到 Web 服务并返回经过验证的集合,显示哪些字段需要更正,哪些字段有效。
目前该对象的结构如下:
export interface IBulkUserObject {
FirstName: string;
GlobalLogin: string;
JobTitle?: string;
LastName: string;
Organization?: string;
PhoneNumber: string;
}
基本上我需要弄清楚如何对这个对象进行基本验证。显然,从客户端获取这些信息非常简单,但我不完全确定如何指示哪些字段有效,哪些无效,然后将此信息传递给 kendo 网格。
this.fullGrid = $("#verifyGrid").kendoGrid({
dataSource: {
data: this.gridData,
schema: {
model: {
id: "GlobalLogin",
fields: {
Organization: { type: "string" },
GlobalLogin: { type: "string" },
FirstName: { type: "string" },
LastName: { type: "string" },
PhoneNumber: { type: "string" },
JobTitle: { type: "string" }
}
}
},
pageSize: 100
},
height: 650,
scrollable: true,
sortable: true,
filterable: true,
pageable: {
input: true,
numeric: false
},
columns: [
{ command: ["edit"], width: "100px" },
{
field: "Organization",
title: "Organization",
width: "200px"
},
{
field: "GlobalLogin",
title: "Global Login",
width: "200px"
},
{
field: "FirstName",
title: "First Name",
width: "200px"
},
{
field: "LastName",
title: "Last Name",
width: "200px"
},
{
field: "PhoneNumber",
title: "Phone Number",
width: "200px"
},
{
field: "JobTitle",
title: "Job Title",
width: "200px"
}
],
editable: "inline",
save() {
alert("edited");
}
});
编辑
发布了一个可能的解决方案。
【问题讨论】:
标签: javascript c# asp.net rest typescript