jQWidgets Forums

jQuery UI Widgets Forums TreeGrid Children doesn't appear

This topic contains 2 replies, has 2 voices, and was last updated by  eddi0815 9 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Children doesn't appear #77219

    eddi0815
    Participant

    Hallo Forum,
    I don’t find the mistake why the children doesn’t appear in the view. I hope you can help me.
    Thanks.

    Data:

     var itemDetails = 
                [            
                    {"Id": 0, "Key": "Id", "Value": item.id},
                    {"Id": 1, "Key": "Name", "Value": item.name},
                    {"Id": 3, "Key": "Description", "Value": item.description},
                    {"Id": 4, "Key": "Datatype", "Value": item.datatype.id, children: [
                        {"Id": 5, "Key": "Basetype", "Value": "Test2"}
                    ]},
                    {"Id": 10, "Key": "Name", "Value": item.name},
                    {"Id": 11, "Key": "Name", "Value": item.name},
                    {"Id": 12, "Key": "Name", "Value": item.name},
                    {"Id": 13, "Key": "Name", "Value": item.name}         
            ];
    
    var source =
            {
                dataType: "json",
                dataFields: [
                    { name: 'Id', type: 'number' },
                    { name: 'Key', type: 'string' },
                    { name: 'Value', type: 'string' }
                ],
                hierarchy:
                {
                    root: 'children'
                },
                id: 'Id',
                localData: itemDetails
            };
            var dataAdapter = new $.jqx.dataAdapter(source);
            // create Tree Grid
            $("#treeGrid").jqxTreeGrid(
            {
                width: '100%',
                height: '100%',
                columnsResize: true,
                theme: 'arctic',
                source: dataAdapter,
                sortable: false,
                columns: [
                    { text: 'Key', dataField: 'Key', width: '49%' },
                    { text: 'Value', dataField: 'Value', width: '49%' }
                ]
            });
    
    Children doesn't appear #77224

    Vladimir
    Participant

    Hello eddi0815,

    The reason the children do not appear is that you have not included the ‘children’ element in the source dataFields,
    change it to:

                   dataFields: [
                        { name: 'Id', type: 'number' },
                        { name: 'Key', type: 'string' },
                        { name: 'children', type: 'array' },
                        { name: 'Value', type: 'string' }
                    ],

    Best Regards,
    Vladimir

    jQWidgets Team
    http://www.jqwidgets.com

    Children doesn't appear #77229

    eddi0815
    Participant

    Hallo Vladimir,

    Great. That works.
    Thank you.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.