jQuery UI Widgets Forums Navigation NavigationBar, ToolBar, NavBar Tree JSON Call set checkbox of item

This topic contains 2 replies, has 2 voices, and was last updated by  codinggal 4 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Tree JSON Call set checkbox of item #104949


    Hi all,

    i have researched this and can not find a solutions

    my Scenario is the following
    1) Restful web service call using the dataadapter
    2) my json is named the same as indicated in this page JqWidgets tree documentation
    3) I want to dynamically set whether the checkbox is set for each node based on what is returned from the json property “checked”

    I know the mapping is working as a assigned selected to the value of checked and the first node showed as if it was selected.

    So it seems that the “checked” is not working in the tree when mapping. not sure why. Seems like a no brainer.

    Help would be greatly appreciated.

    here is my code

        //define permission data source
        var permissionListSource =
                datatype: "json",
                url: "/roles/permissions",
                data: {
                    roleId: 1
                    { name: 'id'},
                    { name: 'parentid' },
                    { name: 'label' },
                    { name: 'value' },
                    { name: 'checked', type: 'bool'}
                id: 'id',
                async: false
        var permissionListData = new $.jqx.dataAdapter(permissionListSource);
        // get the tree items. The first parameter is the item's id. The second parameter is the parent item's id. The 'items' parameter represents 
        // the sub items collection name. Each jqxTree item has a 'label' property, but in the JSON data, we have a 'text' field. The last parameter 
        // specifies the mapping between the 'text' and 'label' fields.  
        var permissionRecords = permissionListData.getRecordsHierarchy(
            'id', 'parentid',
                { name: 'label', map: 'label' },
                { name: 'checked', map: 'checked' },
                { name: 'checked', map: 'selected' },
        $('#treeview').jqxTree({ source: permissionRecords, width: '92%', hasThreeStates: true, checkboxes: true });

    here is my json being returned from my webservice

          "label":"Manage Users",
          "label":"Manage Roles",
          "label":"Manage Company Profile",
          "label":"Send User Invitation",


    Hello codinggal,

    At the moment of creating the source the all items except first are not checked.
    Immediately after the initialization is expecting all to be selected (because of hasThreeStates property).
    Please, take a look at this example.

    Best Regards,
    Hristo Hristov

    jQWidgets team


    Thanks Hristo, you are right… It did not propagate down. I corrected it on the server side to force it. Sorry I posted in the wrong forum… Don’t know how that happened.

    and thanks for showing me client side checking because I am going to need that with something I am going to do…

    Look forward to working with jqwidgets controls in my project.

    Have a wonderful day,


    • This reply was modified 4 years, 11 months ago by  codinggal.
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.