Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"set" property editor doesn't support ajax request for getting choices #720

Closed
xxxKOTxxx opened this issue Mar 31, 2020 · 11 comments
Closed
Labels
Milestone

Comments

@xxxKOTxxx
Copy link

Hello!

To begin with, I would like to thank you for creating an excellent library!

So it’s my turn to add tags to the question.
The most suitable in my situation, I consider the "set" property editor.

But I have two questions:

  1. How can I get choises from the backend?
    Unfortunately choicesCallback parameter is null instead of function in choises function callback.
    It also doesn't support promises as I understand. So can you propose some other way?

  2. My backend return objects because I need to support localizations, but as I can see it supports only string values? Any suggestions?

@andrewtelnov
Copy link
Member

@xxxKOTxxx Sorry, I could not understand your task. Do you want to get the choices for a property from a service?

Thank you,
Andrew

@xxxKOTxxx
Copy link
Author

@xxxKOTxxx Sorry, I could not understand your task. Do you want to get the choices for a property from a service?

Yes, i need load tag entities list from backend and show them in new file widget property as multiselect. Currently I created custom editor using select2. But it will be much easier to use set with choicesCallback if You add it.

@andrewtelnov
Copy link
Member

@xxxKOTxxx Do you refer to the example that shows how to get countries from rest service?

Thank you,
Andrew

@xxxKOTxxx
Copy link
Author

@xxxKOTxxx Do you refer to the example that shows how to get countries from rest service?

Yep! But I can't use it because of null in choicesCallback

@andrewtelnov
Copy link
Member

@xxxKOTxxx When it happens? It works for me. Here is the example.

Thank you,
Andrew

@xxxKOTxxx
Copy link
Author

@xxxKOTxxx When it happens? It works for me. Here is the example.

Yes, it works. But look here

I just changed type to "set" (I need multiselect) and it not works any more. I log in console choicesCallback and it's null.

That's I told about.

@andrewtelnov
Copy link
Member

@xxxKOTxxx Got it now. "set" is property editor type. I will take a look.

Thank you,
Andrew

@andrewtelnov andrewtelnov added bug and removed question labels Mar 31, 2020
@xxxKOTxxx
Copy link
Author

@xxxKOTxxx Got it now. "set" is property editor type. I will take a look.

Thank you! One more question: have you any example, how to correct implement nonvalue custom widet like html widget?

@andrewtelnov andrewtelnov changed the title Questions about "set" property editor "set" property editor doesn't support ajax request for getting choices Apr 1, 2020
@andrewtelnov andrewtelnov added this to the v1.5.19 milestone Apr 1, 2020
@andrewtelnov
Copy link
Member

@xxxKOTxxx I added support for callback function for set property editor by the commit above. New unit test was added. The fix will come with v1.5.19 that we will release next week.

Regarding your last question, please create a new issue that we can discuss in a new thread.

Thank you,
Andrew

@xxxKOTxxx
Copy link
Author

Regarding your last question, please create a new issue that we can discuss in a new thread.
Thank You!

I added new issue.

So i need to transform backend option data objects to strings in callback or there is more easiest way that I missed out?

@andrewtelnov
Copy link
Member

@xxxKOTxxx It can be a single value or a pair value/text. Here is the example for returned choices array:
[1, "text 2", {value: 3, text: "My Text 3"}]

Thank you,
Andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants