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

Async loading of fields #175

Open
alfechner opened this issue Mar 25, 2020 · 5 comments
Open

Async loading of fields #175

alfechner opened this issue Mar 25, 2020 · 5 comments

Comments

@alfechner
Copy link

I have MetaData entries stored on my server. MetaData identifies a value in the database, it's doesn't contain the value itself. A MetaData object holds a DataType, i.e. StringDataType, IntegerDataType.

I want my user to be able to create a query based on a MetaData entry. The available operators shall be based on the DataType.

As far as I understand this is perfectly doable with react-awesome-query-builder as long as I know the list of available MetaData objects beforehand.

In my use case there are a lot. I want my user to be able to do the following:

  1. From the select the user selects type "MetaData"
  2. Next to the select a async search input will be presented to browse the available MetaData on the server
  3. The user selects a MetaData

Is this doable with this library?

@ukrbublik ukrbublik pinned this issue Mar 25, 2020
@ukrbublik ukrbublik unpinned this issue Apr 9, 2020
@alfechner
Copy link
Author

To continue on that: I basically need a way to dynamically add rule fields to the configuration. To my understanding the rule operators and rule values can be customized via the configuration.

Is it currently supported/possible to override/replace the select with i.e. an auto complete?

@alfechner
Copy link
Author

Update: I overwrote the SelectField using the config. Now I'm able to query for available MetaData via an auto AutocompleteField. However, I don't see any way to dynamically update the Config from here. Any advice would be highly appreciated.

@A-Ghorab
Copy link

A-Ghorab commented Jan 19, 2021

Update: I overwrote the SelectField using the config. Now I'm able to query for available MetaData via an auto AutocompleteField. However, I don't see any way to dynamically update the Config from here. Any advice would be highly appreciated.

might be a late replay.

but my fix was to create a new component widget that i return in the factory.

group_select: { ...BasicConfig.widgets.select, factory: ({ value, setValue, allowCustomValues, readonly, placeholder, customProps }) => { const onChange = (e, data) => { setValue(data?.value?.value || ""); }; return <GroupPicker readonly={readonly} label={placeholder} selectedValue={value} onChange={onChange} />; }, },

and internally in that component i call the api and fetch the data only set the value inside the component.

the most elegant way without modifying any thing internally in the tool also without the need to reset the state for the config to load all the data.

@ukrbublik

This comment has been minimized.

@cruperman
Copy link

Hello there! Any updates here? I have to create a dynamic filter constructor and this feature with asynchronous configuration can help me wery well
Maybe @alfechner solved it by another method?

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

No branches or pull requests

4 participants