Is there a way to dynamically change which fields are available to Angular-QueryBuilder?
I've tried:
- Updating the
fieldsproperty of myQueryBuilderConfig.- Nothing happens.
- Removing and re-adding the component using
ngIfandChangeDetectorRef.- The fields do update.
- However, now certain fields break the query builder. When any of those fields is selected, the add rule and add ruleset buttons appear to do nothing. You have to remove the problem field before your additions show up.
- Video: https://i.imgur.com/UXZgpQ4.mp4
My issue was my field objects. They didn't have
valueproperties, soAngular-QueryBuilderwas creatingvalueproperties whose values were auto-incrementing integer IDs.Since I was filtering from a source array without deep-cloning,
valuewas also getting set on the objects in the source array. Then the indices would be wrong when items were removed after filtering.