jQuery UI Widgets Forums TreeGrid Seeking input on: TreeGrid. Thanks!

This topic contains 1 reply, has 2 voices, and was last updated by  admin 11 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Seeking input on: TreeGrid. Thanks! #136091

    sande
    Participant

    How do I access and modify the underlying data source of jqxTreeGrid dynamically with jQuery?

    Seeking input on: TreeGrid. Thanks! #136111

    admin
    Keymaster

    Hi,

    You can set the source property to a new value and it will re-render the Tree Grid.

    // Define new source
    var newSource = {
        dataType: "json",
        dataFields: [
            { name: 'id', type: 'number' },
            { name: 'name', type: 'string' },
            { name: 'children', type: 'array' }
        ],
        hierarchy: {
            root: 'children'
        },
        id: 'id',
        localData: [
            { id: 1, name: "New Parent", children: [
                { id: 2, name: "New Child 1" },
                { id: 3, name: "New Child 2" }
            ]}
        ]
    };
    
    var newAdapter = new $.jqx.dataAdapter(newSource);
    
    // Update TreeGrid dynamically
    $("#treeGrid").jqxTreeGrid({ source: newAdapter });

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.