Issue #2300✓ SolvedOpened September 30, 2019by CatalinCernea5 reactions

How to change order of categories?

Quick answerby CatalinCernea3

> but I was able of adding it only on new categories created.you can do this on all blocks by leveraging from getAll function. more on this here:for your case it might be something like this: cheers! Thank you! I'll try it ASAP. Have a good day.

Read full answer below ↓

Question

I saw the changes done by @JuanTincho of adding the "Order" attibute but I was able of adding it only on new categories created. I started from the "GrapesJs-Preset-Webpage". Is there a way of changing the Order after the initial render? This is how I add a new category by adding a new block.

<pre>editor.BlockManager.add('Cards', { label: 'Cards', content: '<div class="ic-cards"><span>Put your content here</span></div>', category:{ label: 'MyCategory', order: 1, open: true }, attributes: { title: 'Insert Cards', class: 'fa fa-cube' } });</pre>

Answers (3)

👍 Most helpfulCatalinCerneaOctober 1, 2019

> but I was able of adding it only on new categories created.you can do this on all blocks by leveraging from getAll function. more on this here:for your case it might be something like this: cheers! Thank you! I'll try it ASAP. Have a good day.

pouyamiralayiSeptember 30, 2019

but I was able of adding it only on new categories created. you can do this on all blocks by leveraging from getAll function. more on this here: for your case it might be something like this: cheers!

DzevadSNovember 27, 2020

Why am I getting an error "Uncaught TypeError: n is undefined" here? In the post #780 it should be possible to change the order of blocks in the following way const bm = editor.BlockManager; ["link", "map", "h-navbar", "countdown", "form", ... ].forEach(function (item) { bm.remove( item ); }); cons...

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.