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

changed behavior on re-create

2 Answers 27 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Frederic
Top achievements
Rank 1
Veteran
Iron
Frederic asked on 01 Jun 2020, 03:28 PM

Hi, we updated our kendo version to the latest, and we found something strange.

I know, it's our fault, we shoud not "re-create" a kendo item, but we should check for widgetInstance, or .data("kendoxxx") before creating it.

But, in the previous version, we did not have that bug.

I think that you try to do your best to give us in return the previous instance if it already exists, but in that case, you did something more.

Look at this.

https://dojo.telerik.com/@foxontherock/eCiRiFaZ

If I use setOptions ( in button click), no issue.

If I use kendoListView, to "re-create" it (in fact I don't want it to be re-created, but anyway...) it looks fine, but if you "inspect element", you will see an empty "k-listview-content" generated every time.

We adjust our code to check if the component is already created before creating it.  

But I take time to mention it to you, because in the previous version, it was working without problems, when we tried to re-create a component by mistake.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 03 Jun 2020, 12:09 PM

Hello Frederic,

 

Thank you for getting back to us.

Creating a widget using an existing widget instance is not recommended. This also applies for previous versions of the components. If such code was working before it was likely an accident. Using an existing instance to create a new widget will likely result in unexpected behavior.

 

If you would like to change the settings of an existing widget it is recommended to use the setOptions method for it.

 

Regards,
Viktor Tachev
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
Frederic
Top achievements
Rank 1
Veteran
Iron
answered on 03 Jun 2020, 12:51 PM
Yes, I know we were lucky it worked before, and it's not something we should do.  We try to use the kendo.widgetInstance most of the time.  But I just want to mention you that it worked before, and now it doesn't. But we changed our code according to it. Thank you.
Tags
ListView
Asked by
Frederic
Top achievements
Rank 1
Veteran
Iron
Answers by
Viktor Tachev
Telerik team
Frederic
Top achievements
Rank 1
Veteran
Iron
Share this question
or