I have a 3 level hierarchical data set where there may or not be children at level 2 and 3. If child records do not exist for a given parent, then the grid will not bind. The console shows the following error message: Uncaught error: There was an error parsing the Json data and applying the defined data schema. The input data doesn't match the schema, the following field couldn't be mapped: XXXXXX (Where xxxxx equals the Child element. The data set is created by LINQ, data relations were created and the properly Nested=True is set. I verified that the Child element is not created if there are no child records (in the Json data). It appears that the Data source always expects it to be there. What is the easiest way to get past this error:
Here is the Grid config statements:
$(gID).igHierarchicalGrid({
initialDataBindDepth: 2,
dataSource: runSummaryJson,
dataSourceType:
"json",
responseDataKey:
'NewDataSet.Run',
childrenDataProperty:
"Assignment",
autoGenerateColumns:
false,
primaryKey:
"ID",
key:
"Run",
fixedHeaders:
true,
height:
"600px",
width:
"100%",
columns: [
{ headerText:
"ID", key: "ID", width: "50px", dataType: "number" },
"Run", key: "RunID", width: "130px", dataType: "string" },
"Aliass", key: "Aliases", width: "130px", dataType: "string" },
"Description", key: "Description", width: "250px", dataType: "string" },
"Type", key: "Type", width: "75px", dataType: "string" },
"Vehicle", key: "BUSName", width: "100px", dataType: "string" },
"Driver", key: "DriverName", width: "200px", dataType: "string" }
],
autoGenerateLayouts:
columnLayouts: [{
'',
"AID",
foreignKey:
"RunID",
caption:
"Assignments for Run",
"ID", key: "AID", dataType: "number", width: "150px" },
"RunID", key: "RunID", width: "50px", dataType: "number", hidden:true },
"Route", key: "RouteName", width: "200px" },
"Driver", key: "DriverName", dataType: "string", width: "355px" }
'Cover',
"Cover Records for Assignment",
"CID",
"RouteAssignmentID",
"ID", key: "CID", dataType: "number", width: "150px" },
"AID", key: "RouteAssignmentID", dataType: "number", width: "150px", hidden:true },
"Type", key: "Type", dataType: "string", width: "100px" },
"Name", key: "EntityNameCovered", dataType: "string", width: "200px" },
"Covered By", key: "EntityNameCovering", dataType: "string", width: "200px" }
features:
[
{ name:
"Sorting", type: "local", mode: "single" },
"Resizing" }
]
}],
});
Hello,
Is it possible to share your datasource that you are using to bind to the grid?
If not, could you please give some requirements and steps so I can try to recreate your scenario, because I am not able to do so.