Issue #1966💬 AnsweredOpened April 19, 2019by trafalmejo0 reactions

Loop over all components

Quick answerby artf

Hi @trafalmejo in case you need to iterate component's first level children you can do this: If you need to lookup ALL inner children, use onAll Once the component is rendered you can also make use of find method and pass any query selector string

Read full answer below ↓

Question

Hi all,

I want to create a socket for every button that I add to the canvas. This is working just fine. However, when I reload (using storage), I have to look for my components of type "Button" and reopen the sockets. Is it a way to loop over the components?

Best,

Answers (3)

artfApril 23, 2019

Hi @trafalmejo in case you need to iterate component's first level children you can do this: If you need to lookup ALL inner children, use onAll Once the component is rendered you can also make use of find method and pass any query selector string

trafalmejoApril 24, 2019

Perfect! Highly appreciated.

lock[bot]April 25, 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.