Hi Alex,
Thank you for contacting Syncfusion support.
Query 1: My requirement is simple, i have a list of countries, each of them has a list of city. They are stored in database. I retrieve it by using sql and made a datatable with 3 columns (id, country, city), i want to present it in a tree.
We have provided the Data Binding support for TreeViewAdv in our latest Volume 2 Beta 2019 release. Currently TreeViewAdv supports binding to Self-Referencing data and Relational Binding. Based on your query we have prepared a sample with Self-Referencing Data Table. Here the Parent-Child relationship is defined by setting the ParentMember and ChildMember to the respective fields in the DataSource. The data object in the ParentMember field of the DataSource that matches with the TreeViewAdv.SelfRelationalRootValue are the root nodes. Please use the below properties to bind to Self-Referencing data in TreeViewAdv.
Property |
Description |
DataSource |
Gets or sets the Data Source object in TreeViewAdv |
DisplayMember |
Gets or sets the field that populates the Text property of the TreeNodeAdv in TreeViewAdv |
ValueMember |
Gets or sets the field that populates the Value property of TreeNodeAdv in TreeViewAdv |
ParentMember |
Gets or sets a value indicating the parent data field which behaves as a Parent Node in TreeViewAdv |
ChildMember |
Gets or sets a value indicating the child data field which behaves as a Child Node in TreeViewAdv |
DataMember |
Gets or sets the table name that should be bound to the TreeViewAdv |
CheckedMember |
Gets or sets a value indicating the field to populate the state of checkbox of TreeNodeAdv in TreeViewAdv |
ValueMember |
Gets or sets the field that populates the Value property of TreeNodeAdv in TreeViewAdv |
SelfRelationalRootValue |
Gets or sets the value that defines the root object in a self-relational mode when DataSource is used to define the underlying tree data. |
Note: The above properties will work only in our latest Volume 2 Beta, 2019 release.
Query 2: Another requirement is when i change the datatable, it should reflect on the treeviewadv.
Currently TreeViewAdv do not support Dynamic update of the underlying changes in data source settings. This feature will be implemented in our Volume 3, 2019 which is expected to be available in the month of September 2019. We appreciate your patience until then.
You can track the status of this report through the following feedback link,
Regards,
Subburaj Pandian V