This is a migrated thread and some comments may be shown as answers.

How to populate indetermined states when loading on demand ajax/json

1 Answer 11 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 28 Dec 2016, 08:47 PM

Hello, 

I am loading a large list with checkboxes, some of the nodes have several subnodes checked and the data is peristed in a database.

I am using on demand loading with ajax json calls.

I can set the checkbox to true or false, but is there a way to set it to indetermined?

1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 30 Dec 2016, 08:19 AM
Hello Ali,

I would suggest you to try the CheckboxTemplate approach, proposed in the following blog post. Note that the suggested implementation is for MVC HTML helper. It would be translated to the following JavaScript initialization:
$("#treeview").kendoTreeView({
    checkboxes: {
        checkChildren: true,
        template: "<input type='checkbox' name='checkedNodes' value='#= item.id #' #if(item.checked) { # checked # } if(item.indeterminate) { # data-indeterminate # } #/>"
    },
    dataSource: {
        transport: {
            read: {
                url: serviceRoot + "/Employees",
                dataType: "jsonp"
            }
        },
        schema: {
            model: {
                id: "EmployeeId",
                hasChildren: "HasEmployees"
            }
        }
    },
    dataTextField: "Name",
    dataBound: updateTree
});

Regards,
Veselin Tsvetanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TreeView
Asked by
Ali
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or