Issue #1889πŸ’¬ AnsweredOpened March 13, 2019by Nagavijay-kolla0 reactions

How to append a child component at required position/index

Quick answerby artf

Use at, as an index, in options, eg. component.append(comp, { at: 0 }) will place the comp as a first element

Read full answer below ↓

Question

For example, I have a parent component and this parent component has 4 child components. Here with trait functionality, I want to move the 3rd child component to 1st position likewise.

I am able to move a component from any position to last by removing it from the existing position using component.remove() and adding it to parent using component.append(ref of removecomponent) . So it is moving to last.

Now I want to move a child component from one place to another place on trait value change

Can you give me any idea?

Thanks in Advance.

Answers (2)

artfβ€’ March 22, 2019

Use at, as an index, in options, eg. component.append(comp, { at: 0 }) will place the comp as a first element

lock[bot]β€’ March 21, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.