Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Dataset with Null children set will not Bind
posted

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" },

                     { headerText:

"Run", key: "RunID", width: "130px", dataType: "string" },

                     { headerText:

"Aliass", key: "Aliases", width: "130px", dataType: "string" },

                     { headerText:

"Description", key: "Description", width: "250px", dataType: "string" },

                     { headerText:

"Type", key: "Type", width: "75px", dataType: "string" },

                     { headerText:

"Vehicle", key: "BUSName", width: "100px", dataType: "string" },

                     { headerText:

"Driver", key: "DriverName", width: "200px", dataType: "string" }

                 ],

                 autoGenerateLayouts:

false,

                 columnLayouts: [{

                     key:

"Assignment",

                     responseDataKey:

'',

                     primaryKey:

"AID",

                     foreignKey:

"RunID",

                     width:

"100%",

                     caption:

"Assignments for Run",

                     fixedHeaders:

true,

                     autoGenerateColumns:

false,

                     columns: [

                         { headerText:

"ID", key: "AID", dataType: "number", width: "150px" },

                         { headerText:

"RunID", key: "RunID", width: "50px", dataType: "number", hidden:true },

                         { headerText:

"Route", key: "RouteName", width: "200px" },

                         { headerText:

"Driver", key: "DriverName", dataType: "string", width: "355px" }

                     ],

                     autoGenerateLayouts:

false,

                     columnLayouts: [{

                         key:

'Cover',

                         responseDataKey:

'Cover',

                         caption:

"Cover Records for Assignment",

                         primaryKey:

"CID",

                         foreignKey:

"RouteAssignmentID",

                         fixedHeaders:

true,

                         autoGenerateColumns:

false,

                         columns: [

                             { headerText:

"ID", key: "CID", dataType: "number", width: "150px" },

                             { headerText:

"AID", key: "RouteAssignmentID", dataType: "number", width: "150px", hidden:true },

                             { headerText:

"Type", key: "Type", dataType: "string", width: "100px" },

                             { headerText:

"Name", key: "EntityNameCovered", dataType: "string", width: "200px" },

                             { headerText:

"Covered By", key: "EntityNameCovering", dataType: "string", width: "200px" }

                         ],

                         features:

                         [

                            { name:

"Sorting", type: "local", mode: "single" },

                            { name:

"Resizing" }

                         ]

                     }],

                 }],

             });

 

Parents
No Data
Reply
  • 71886
    Offline posted

    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.

Children
No Data