Hi,
Am having an issue with retrieving the child nodes of my tree-view. I’m thinking there might be something wrong with the JSON string format that I’m returning from the server.
Code:
var source =
{
datatype: "json",
async: false,
datafields: [
{ name: 'id' },
{ name: 'parentid' },
{ name: 'label' }
],
items: [
{ name: 'id' },
{ name: 'parentid' },
{ name: 'label' }
],
id: 'id',
url: 'Charts.aspx?callback=GetTreeData'
};
var dataAdapter = new $.jqx.dataAdapter(source);
dataAdapter.dataBind();
var records = dataAdapter.getRecordsHierarchy("id", "parentid", "items");
$('#jqxWidget').jqxTree({ source: records, width: '300px' });
This is the JSON string I’m receiving from the server:
[{“id”:”178″,”parentid”:”-1″,”label”:”Parent Item 1″,”value”:null,”icon”:null,”items”:[{“id”:”78″,”parentid”:”178″,”label”:”Child Item 1″,”value”:null,”icon”:null,”items”:null},{“id”:”79″,”parentid”:”178″,”label”:”Child Item 2″,”value”:null,”icon”:null,”items”:null} …… and so on…
My tree view is only displaying the root nodes but not any child nodes.
Kindly advise me on what I’m doing wrong.
Thank you in Advance,
AJ