TileLayout - Adding and Removing Items

1 Answer 36 Views
TileLayout
Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
Jeffrey asked on 01 Aug 2022, 04:03 PM | edited on 01 Aug 2022, 04:03 PM

Hello

I'm looking at the kendo demo on Adding and Removing Tiles.

I would like some confirmation...

When I remove an item (splice it) from main items, I have to reorder the containers from 0 to remaining items.

That seems to work fine....HOWEVER

It appears the demo wants me to recreate every widget in the tile....really?

I have toolbars and grids and charts in my tiles.  It appears by using the setOptions on the containers...I am losing all this previously configured information and I now have to make countless calls out to the server again. 

Why would a setoption clear all the toolbars, grids, and charts?

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 04 Aug 2022, 08:33 AM

Hi, Jeffrey,

The setOptions method works in the same manner for every widget. In order for the new options to be reflected, the widget(TileLayout in this case) is destroyed, the element from which the widget is created(the div) is emptied and only after that the widget is reinitialized.

Since the entirety of the TileLayout content is cleared, all other widget elements also disappear from the DOM. Therefore, they must be reinitialized again afterwards.

One idea that comes to my mind is to set the autoBind property of the different widgets(grids, charts) to false. The widget won't request the data, until dataSource.read() is manually called.

You could either make this a user-interaction(a button click to request the data for all of the widgets) or use some sort of setTimeout. If setOptions hasn't been called in X amount of time, fetch the data for the different widgets.

While the above suggestion doesn't stop the requests, it should limit them to some extent in certain scenarios. For example, if a user wants to add several containers at once, instead of requesting data on every addition, wait for the user to finish with the process and then fetch the data.

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
commented on 04 Aug 2022, 12:54 PM

Thank you.  I understand.  There are just a few things that get in the way with actually destroying the objects. 

For example, all of our tiles use remote data - Ajax calls are in progress.  If a widget is destroyed then the response comes back to a method that can no longer access the component.  It can all be handled by implementing more error checking....but normally I would forgo checking if an objects exists check if the object was the one to send the message. 

Thank you again for the response,  We have it working well now.  The only part of the control that is quite frustrating is the auto collapsing.  We prefer the widgets be allowed to be placed in any grid position without "floating" up as much as possible.  If I set a component in row 1, column 4 it should not auto float (or position) to row 0, columns 1 just because the only other item in the grid is in row 0, column 0.

Anyhow, all good for now.

Jeff

 

Upscale
Top achievements
Rank 1
commented on 08 Aug 2022, 08:09 AM

Thank you so much Jeffery for your kind response. You have helped me too. 
Georgi Denchev
Telerik team
commented on 09 Aug 2022, 07:42 AM

Hello, Jeffrey,

Thank you for sharing your feedback. I'll make sure to forward it to the Managers and Dev team.

Best Regards,

Georgi

Tags
TileLayout
Asked by
Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Georgi Denchev
Telerik team
Share this question
or