<p>I'm using formattingAdd in a JSON config file for redactor. The items do not appear in the menu in the order I define them.</p>

<p>After some searching I realise the format for formattingAdd is an object and each format is a property of that object. Javascript does not guarantee the order of properties returned from an object.</p>

<p>The redactor source code uses jQuery $.each which cannot 'fix' the issue with javascript not ordering the properties of an object.</p>

<p>Does anyone have a workaround for this? I could change the code in craft/app/resources/lib/redactor/redactor.js to accept an array of objects for formattingAdd but I guess it would be overwritten everytime I upgrade craft.</p>

CC BY-SA 3.0
2017-03-31T09:41:33.320Z
I am curious, using which browser do you experience this?
carlcs
CC BY-SA 3.0
2017-04-05T10:31:08.457Z
Safari on Mac, also tested on Chrome and it behaves in the same way.
TC0072
CC BY-SA 4.0
2019-02-24T14:46:37.403Z
No idea why this was down-voted; I'd love to have a solution to this, too. One of the `formattingAdd` options I'm adding should be _above_ the H1. :-/
Sandwich
<redactor>
Order of Redactor format options using formattingAdd
# Order of Redactor format options using formattingAdd

(Asked by: username_0 on 2017-03-31)

I'm using formattingAdd in a JSON config file for redactor. The items do not appear in the menu in the order I define them.

After some searching I realise the format for formattingAdd is an object and each format is a property of that object. Javascript does not guarantee the order of properties returned from an object.

The redactor source code uses jQuery $.each which cannot 'fix' the issue with javascript not ordering the properties of an object.

Does anyone have a workaround for this? I could change the code in craft/app/resources/lib/redactor/redactor.js to accept an array of objects for formattingAdd but I guess it would be overwritten everytime I upgrade craft.

**Tags:** redactor

> **Comments:**
> **username_1**: I am curious, using which browser do you experience this?  
> **username_0**: Safari on Mac, also tested on Chrome and it behaves in the same way.  
> **username_2**: No idea why this was down-voted; I'd love to have a solution to this, too. One of the `formattingAdd` options I'm adding should be _above_ the H1. :-/  

---

## 0 answers

