How to dynamically change Layer order in a GridLayout



Based on a request from this thread,

I have made a sample NS Playground app to dynamically change the order of layers in a GridLayout.

Here’s the link to it.

Here’s the trick. You just remove and add that element to the same grid layout.

Remove by doing, gridLayout.removeChild(element);

Add by doing, gridLayout.addChild(element);

hope this is useful to someone out there!, Cheers. Happy NativeScripting :slight_smile:

Here’s the result

How to layer items in NativeScript

smart hack :thinking:


Initially, I was unsure whether this would work because the element does contains the details of the row and column.
Thanks to playground, I could try it out quickly.


Cool stuff, dude! @multishiv19 I like! :+1:


Thanks @kommitareeben :smiley: