jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree Hierarchy data in jqxTree does not load

This topic contains 2 replies, has 2 voices, and was last updated by  Klaus Qvist 9 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Hierarchy data in jqxTree does not load #80698

    Klaus Qvist
    Participant

    Dear support

    I have this problem that is really giving my a headache. I have the following code and JSON data – the result is an empty tree – what am I doing wrong?

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘FolderId’ },
    { name: ‘ParentId’ },
    { name: ‘Name’ }
    ],
    id: ‘FolderId’,
    url: ‘/api/FolderList1View/’
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    dataAdapter.dataBind();
    var records = dataAdapter.getRecordsHierarchy(‘FolderId’, ‘ParentId’, ‘items’, [{ name: ‘Name’, map: ‘label’ }]);
    $(‘#jqxTree’).jqxTree({
    allowDrag: true, allowDrop: true,
    height: ‘100%’, width: ‘100%’,
    source: records
    });
    $(“#jqxTree”).jqxTree({ theme: “arctic” });
    $(‘#jqxTree’).css(‘visibility’, ‘visible’);

    The JSON data file is passed from SQL server:

    <ArrayOfFolderList1View xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.datacontract.org/2004/07/PTW10″>
    <FolderList1View>
    <FolderId>1</FolderId>
    <Name>Folder 1</Name>
    <ParentId>-1</ParentId>
    </FolderList1View>
    <FolderList1View>
    <FolderId>2</FolderId>
    <Name>Folder 2</Name>
    <ParentId>1</ParentId>
    </FolderList1View>
    <FolderList1View>
    <FolderId>3</FolderId>
    <Name>Folder 3</Name>
    <ParentId>2</ParentId>
    </FolderList1View>
    <FolderList1View>
    <FolderId>4</FolderId>
    <Name>Folder 4</Name>
    <ParentId>3</ParentId>
    </FolderList1View>
    </ArrayOfFolderList1View>

    Can you please help me, Klaus?

    Hierarchy data in jqxTree does not load #80701

    ivailo
    Participant

    Hi Klaus,

    From your presented code, the response from the server is in XML version.
    Try to use datatype: “xml”.
    Also this article may be helpful for you.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Hierarchy data in jqxTree does not load #80703

    Klaus Qvist
    Participant

    Hi Ivailo

    Thank you for the reply; however I have already tried this and it did unfortunately not help… Sorry

    Best Regards Klaus

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

You must be logged in to reply to this topic.