I am having issues with getting the dynamic data to load. I have a method call
BuildCategories which gets the data and then builds a temporary list:
var categories = await AssemblyService.GetAssemblyCategories();
var tempCategories = new List();
tempCategories.Add(new CategoryItem()
{
Id = "0",
Text = "All",
Expanded = true,
HasChildren = true
});
At the end of the method it sets the DataSource:
Categories = tempCategories
And my TreeView is defined as:
Now I have to call the build method from the OnAfterRender method because I have to retrieve some information from session storage and need to use JsInterop. If I don't put StateHasChanged() at the end of the build method, nothing shows. If I do, the I get the following error message:
this.adaptor.processQuery is not a function
TypeError: this.adaptor.processQuery is not a function
at e.executeLocal (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:1117777)
at Object.a [as getDataSource] (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:1126627)
at t.getGroupedData (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:2482634)
at t.setRootData (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:2475129)
at t.setDataBinding (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:2474270)
at t.reRenderNodes (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:2517477)
at t.onPropertyChanged (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:2545443)
at t.e.dataBind (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:396519)
at t.dataBind (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:450253)
at t.e.setProperties (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:395782)
However, if I call the BuildCategories method from the OnInit method, then it works fine. I should mention that even though the method is called from the OnAfterRender method, I do have a boolean to prevent the method from recalling the function indefinitely.