Completed
Last Updated: 23 Dec 2021 13:26 by ADMIN
Release 3.0.0
Robert
Created on: 08 Oct 2020 07:58
Category: TileLayout
Type: Feature Request
15
How to know which indiviadulal TileItem was resized (Tag parameter on the tile)
I need to execute certain logic only for the particular tile that resized, and at the moment the OnResized event fires for any tile that gets resized. Ideally, a Tag or some similar Parameter on the individual tiles can be set and I could receive it in the OnResized handler to know which tile to target.
4 comments
Nikolas
Posted on: 02 Jun 2021 11:25

Hello @Philip,

 

What is PBIEmbeds and CurrentState?

I would love to get my Charts to refresh when moving them around

 

BR,

Nikolas

ADMIN
Marin Bratanov
Posted on: 07 Feb 2021 16:00

Hello Philip,

That would be a valid way to know which index was resized.

Resizing a tile does not reorder tiles, and reordering tiles does not resize them. It may appear that it does because changing sizes and/or positions can alter the entire layout because the tiles will adjust to fill in gaps immediately, but one setting does not affect the other directly.

As for the video - I am not sure what I should be seeing, but I suspect there is code in the tiles that consumes some of the mouse events which might be causing things.

 

Regards,
Marin Bratanov
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/.

Philip
Posted on: 07 Feb 2021 12:27

Is this the best way for now?

(compare a stored "pre-resize" state with the new? - and attach to both OnResize and OnReorder because OnReorder may resize a tile - but the event will not fire in that situation)

 

 

        private async Task OnTileLayoutChange(bool reloadAll = false)
        {
            //get previous/stored state vs newly sized - and compare
            TileLayoutState newState = TileLayoutInstance.GetState();

            for (int i = 0; i < newState.ItemStates.Count; i++)
            {
                if(newState.ItemStates.ElementAt(i).ColSpan != CurrentState.ItemStates.ElementAt(i).ColSpan
                    || newState.ItemStates.ElementAt(i).RowSpan != CurrentState.ItemStates.ElementAt(i).RowSpan || reloadAll == true)
                {
                    await PBIEmbeds.ElementAt(i).ReloadReportAsync();
                }
            }

            CurrentState = newState;
        }

 

@Marin: seems to work ok (attached), but some behaviour that you'll see in the video; like the event doesnt trigger and sometimes the drag event doesnt let go (but maybe that is some interfering css?).

 

Attached Files:
ADMIN
Marin Bratanov
Posted on: 12 Oct 2020 12:15

To add some more information from a separate thread - a Tag parameter on the tile could find its way in the state and that would help with dynamic layouts where you need to also know which tile in your conditional markup the state is about, and you can build state objects with a more content-aware approach.

 

Regards,
Marin Bratanov
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/.