Issue loading prechecked checkboxes from an observablelist

Hello,

When loading prechecked checkboxes from an observablelist , parent is not receiving the recursive checkbox state.
ID = 2 should be checked.
ID = 4 should be on tristate.

Here's an image attached:



Also I've attached a sample with the issue.

Have a nice day,
Alexandru.

Attachment: TreeGridSyncfusion_96640907.rar

1 Reply

GT Gnanasownthari Thirugnanam Syncfusion Team December 7, 2017 04:04 AM UTC

Hi  Alexandru, 
We are able to reproduce the reported problem but Recursive checking is working at runtime so it is behavior in SfTreeGrid due to improve loading performance but you can achieve your requirement by setting parent node state like below cod example. 
void CommandsGrid_Loaded(object sender, RoutedEventArgs e) 
{ 
    foreach (var parentNode in CommandsGrid.View.Nodes.RootNodes) 
    { 
        //You can update the parent node using SetCheckedStae method 
        if (parentNode.ChildNodes.All(n => n.IsChecked == true)) 
        { 
            parentNode.SetCheckedState(true, true, false); 
        } 
        else if (parentNode.ChildNodes.All(n => n.IsChecked == false)) 
        { 
            parentNode.SetCheckedState(false, true, false); 
        } 
        else 
            parentNode.SetCheckedState(null, true, false); 
    } 
} 

We have modified the sample based on your requirement, you can download it from below mentioned location. 
Regards, 
Gnanasownthari T. 


Loader.
Up arrow icon