Hi,
I have "Role" Grid with popup Editor with columns from Cascade drop downs on a popup.
The way I have set throwing error while creating new user Model.
The sample project attached below.
Can any one Help me in it.
Thanks,
Chatrapathi chennam
I have "Role" Grid with popup Editor with columns from Cascade drop downs on a popup.
The way I have set throwing error while creating new user Model.
The sample project attached below.
Can any one Help me in it.
//Parent Dropdown
$("#Type").kendoDropDownList({
dataTextField: "TypeDescription",
dataValueField: "TypeID",
autoBind: false,
optionLabel: "Select Type...",
dataSource: [
{ TypeDescription: "RoleType1", TypeID: 201 },
{ TypeDescription: "RoleType2", TypeID: 202 },
{ TypeDescription: "RoleType3", TypeID: 203 }
],
index: 1
});
//Child Dropdown
$("#Role").kendoDropDownList({
cascadeFrom: "Type",
// cascadeFromField: "parentId",
dataTextField: "RoleDescription",
dataValueField: "RoleID",
autoBind: false,
optionLabel: "Select Role...",
dataSource: {
data: [
{ RoleDescription: "Role1", RoleID: 101, TypeID: 201 },
{ RoleDescription: "Role2", RoleID: 102, TypeID: 202 },
{ RoleDescription: "Role3", RoleID: 103, TypeID: 202 },
{ RoleDescription: "Role4", RoleID: 104, TypeID: 202 },
{ RoleDescription: "Role5", RoleID: 105, TypeID: 203 }
],
filter: {
"field": "RoleDescription",
"operator": function (item) {
var data = $("#roleGrid").data("kendoGrid").dataSource.data();
var status = true;
if (e.model.isNew()) {
for (var j = 0; j < data.length; j++) {
if (item == data[j].Role.RoleDescription) {
status = false;
break;
}
}
}
return status;
}
}
},
index: 1
});
//role Grid data source
roledataSource = new kendo.data.DataSource({
data: e.model.Roles,
pageSize: 10,
serverPaging: false,
serverFiltering: false,
serverSorting: false,
schema: {
model: {
id: "RoleID",
Role: "Role",
Type: "Type",
fields: {
RoleID: { type: "int" },
Role: { defaultValue: { Value: "", Text: "" } },
Type: { defaultValue: { Value: "", Text: "" } },
}
}
}
});
//Role model
public class RoleType
{
public string TypeDescription { get; set; }
public int TypeID { get; set; }
}
public class Role
{
public string RoleDescription { get; set; }
public int RoleID { get; set; }
}
public class RoleModel
{
public int RoleID { get; set; }
public Role Role { get; set; }
public RoleType Type { get; set; }
}
Thanks,
Chatrapathi chennam