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

How to set default value for parentId field

4 Answers 240 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
No
Top achievements
Rank 1
No asked on 07 Jul 2020, 01:17 PM

Hello

 

I have dataset where parentId for root item is empty string. In this situation the tree does not displays ("No records available").

How to set default value for parentId field just like here: https://www.telerik.com/forums/is-parentid-field-required-to-be-null ?

 

Regards

4 Answers, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 09 Jul 2020, 09:19 AM

Hi Grzegorz,

Thank you for the provided feedback.

The root item should have a null or undefined for its parentId property in order for the TreeList to function properly. Indeed, currently there isn't an option to set the default value of the root element's parentId. But that could be achieved by adjusting manually the data before it is passed to the TreeList.

We will also proceed with updating our documentation accordingly to add that information about the root level parentId property. Thank you for pointing our attention to that. I have also updated your account Telerik points for the provided feedback.

Please let us know in case we are missing something or if any further information or assistance is required for this case. Thank you.

Regards,
Svetlin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
No
Top achievements
Rank 1
answered on 09 Jul 2020, 10:23 AM

Thank you for the information. But the option to set a default value for the parentId field would be much better. Think about it.

Regarding the TreeList: field values in the tree do not update automatically. Why ?

For example, if I attach the same dataset to grid and tree and change the value of the record in the dataset, it will be visible in the grid, but not in the tree.

 

0
Svet
Telerik team
answered on 13 Jul 2020, 08:01 AM

Hi Grzegorz,

About the default value, indeed that is a possible update that we can add to the TreeList. That is why I logged a new feature request in our public Feedback Portal:

https://feedback.telerik.com/kendo-angular-ui/1475918-add-an-option-to-set-a-default-value-for-the-parentid-field

that will allow our clients to vote for such feature and we will be able to track its demand which will help us to add its implementation to our future development plans accordingly.

About the second part of the message, the TreeList is implemented to work with On-Push change detection strategy (as opposed to the Grid) which is why when updating one of its items it won't be automatically updated as it wouldn't be re-rendered. What should be done in order to update the view is to call its dedicated updateView() method or bind the TreeList to an Observable which returns a new data set whenever an item property is updated. Here is an example demonstrating the the usage of the updateView() function:

https://stackblitz.com/edit/angular-wnrkrr-6j4via?file=app%2Fapp.component.ts

I hope this helps. Please let us know in case any further information is required for this case. Thank you.

Regards,
Svetlin
Progress Telerik

0
No
Top achievements
Rank 1
answered on 13 Jul 2020, 09:14 AM
Ok. Thanks for the information.
Tags
TreeList
Asked by
No
Top achievements
Rank 1
Answers by
Svet
Telerik team
No
Top achievements
Rank 1
Share this question
or