iam试图将列中的列中置换为一个复杂的对象conta两个属性{id:0,name:'选择中间}
现在,当我在过滤器输入Iam gettig中输入一些值时
vm1033:3 uck typeerror :( d.mid ||; quot; quord;&quort;" tolowercase不是函数
iam geuss这是因为中间是一个对象,而不是预性类型
有什么想法?
谢谢你
这是我的网格:
$("#grid_1").kendoGrid({
dataSource: {
dataType: "d",
transport: {
read: {
url: crudServiceBaseUrl + "/Read",
},
update: {
url: crudServiceBaseUrl + "/Update",
type: "post",
contentType: "application/json; charset=utf-8",
complete: function (e) {
jQuery("#load_balancer_grid").data("kendoGrid").dataSource.read();
}
},
create: {
url: crudServiceBaseUrl + "/Create",
type: "post",
contentType: "application/json; charset=utf-8",
complete: function (e) {
jQuery("#load_balancer_grid").data("kendoGrid").dataSource.read();
}
},
destroy: {
url: crudServiceBaseUrl + "/Delete",
dataType: "d"
},
parameterMap: function (options, operation) {
}
},
batch: true,
pageSize: 100,
schema: {
model: {
id: "MidGroupId",
fields: {
MidGroupId: { validation: { required: true }, editable: true, type: "number" },
Mid: { validation: { required: true }, editable: true, defaultValue: { Id: 0, Name: "Select MID" } },
RouteSales: {
type: "boolean",
parse: function (value) {
if (value != null) {
return value || false;
}
return value;
},
nullable: true
},
RouteRebills: { type: "boolean" },
QueueRebills: { type: "boolean" },
// ResetCounters: { type: "boolean" },
}
}
}
},
sortable: true,
batch: true,
groupable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 5
},
filterable: {
mode: "row"
},
toolbar: kendo.template($("#template").html()),
edit: function(e) {
if (e.model.isNew() == false) {
$(e.container.find("input[name=MidGroupId]")).attr('disabled', 'disabled');
$(e.container.find("input[name=Mid]")).attr('disabled', 'disabled');
$(e.container.find("input[name=CardType]")).attr('disabled', 'disabled');
}
},
columns: [
{
field: "MidGroupId", type: "number"
},
{
field: "Mid", editor: MidDropDownEditor, template: "#=Mid.Name#", title: "MID",
filterable: {
cell: {
dataSource: {
type: "d",
transport: {
read: crudServiceBaseUrl + "/GetMidsOptions"
}
}
,
dataValueField: "Id",
dataTextField: "Name"
}
}
}
],
editable: true
});
iam试图过滤一个对象
per dataSource api直接在数据源上没有数据类型属性,因此在部分下方是不正确的,因此这可能是您错误的原因:
dataSource: {
dataType: "d",
数据类型可以更深入地定义数据源传输的传输CRUD,就像您已经在那里一样。我尚未尝试将一个复杂的对象放在网格列中,为什么不在服务器上进行操作?在服务器上创建原始属性并在网格中轻松使用它是最自然的。
我也遇到了这个问题。该解决方案是在更改处理程序启动时更新编辑器中的dirtyfilds。看起来像:
function MidDropDownEditor(container, options){
$(`<input id="MidEditor" name="Mid" data-bind="value:Mid" />`)
.appendTo(container)
.kendoDropDownList({
autoBind: false,
filter: "startswith",
dataTextField: "Name",
dataValueField: "Id",
enable: false,
change: function(){
if (options.model.dirtyFields['Mid']) {
options.model.dirtyFields['Mid.Name'] = true;
}
}
});
在列设置中,您应该设置属性"字段",例如"中间"。
它对我有用。