How to use Combined Custom Editor

Hi Sebastian,

I’m trying to understand how Custom Editor works and how to use them. I found below documentation and 2 links:

  1. https://docs.squidex.io/guides/07-custom-editors
  2. [SOLVED] Custom editor not working anymore
  3. [IMPLEMENTED] Custom editor - accessing other fields
    I tried adding the sample custom editors in my local Squidex Cms but the editor just not loading/rendering. (Might be similar issue as link #2)

    I’m unsure how to use the combined custom editor as per link #3 (https://github.com/Squidex/squidex/blob/master/src/Squidex/wwwroot/scripts/combined-editor.html) as I also need to do conditional selection in the second field base on the selected value of the first field.
    I’m using docker 3.4.0 build.

Thanks,
May

Just yesterday I have developed a custom editor for a client so I guess that it works … which URL do you use?

Ah apologies, I was on “latest” tag and i tried cke-simple and country-selector, they weren’t working on latest.
I just changed to “3.4.0” specific tag and they are showing up now.
But I still don’t know how to use the combined-editor.

Latest = 3.4.0 … Perhaps you have to pull again.

The combined editor demonstrates how to access other fields. You see in this line how it works: https://github.com/Squidex/squidex/blob/master/src/Squidex/wwwroot/scripts/combined-editor.html#L31

It accesses two other fields called a and b and writes the value in the current field. So you create two number fields for example or two string fields.

1 Like

Just tested it and works perfectly! Thank you so much for prompt reply as always. :slight_smile:

1 Like

Since the post is still open, I just want to ask if anyone tried adding a custom editor in an Array Object?
eg. I got two dropdown lists coming from two custom editors, one making use of combined editor onFormValueChanged sample above to capture the value from parent dropdown and load the child dropdown.
It works fine for normal root level UI but I’m stuck when I need to place it inside Array Object UI…may be I have to take a different approach for this but is there a way to make the custom editors inside have a unique field id or pass the array object item id somehow?
Might be a silly question but any 5cents is much appreciated. :smiley:


Thanks,
May

Yes, this would not work because the editor does not know the index of the nested field. Otherwise you could just get a value with

data.array.iv[INDEX].x

1 Like

Btw: I only close bugs and feature requests.

1 Like

Hello @Sebastian
Does it still work?
My index is always ‘undefined’.

Can you show me your example?

Sure!
The index is always undefined, so the dropdown remains empty.

I have not implemented this… have I mentioned it somewhere?

Btw: Please post your code as code blocks next time. Very hard do read like this.

Forgive me for the previous image.
Did I get your answer wrong?

Yes, I meant: If the index would be available in editors, it could work like this. But the index is not available.

But you can create a feature request if this is important for you.

1 Like