wagtail / wagtail-generic-chooser

A toolkit for custom chooser popups in Wagtail
BSD 3-Clause "New" or "Revised" License
116 stars 25 forks source link

Limiting choices via linked fields with Snippet models #56

Closed charles-co closed 2 years ago

charles-co commented 2 years ago

Hi, I have two snippet models which are Category & Subcategory (i.e. a category can have multiple subcategory), I also have an Article page which has a 1:M to Article Categories (i.e. an article can have multiple categories and sub subcategories in the parent category)

So I thought your package will help a-lot in making this selection dynamic as showing only sub categories in the selected category but I have been unable to make this work for one;

  1. Snippets choosers do not have input fields, so using a selector is unclear. Error thrown when button is clicked; linked-field-chooser-widget.js:52 Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at LinkedFieldChooserWidget.getModalURL (linked-field-chooser-widget.js:52:13) at ChooserWidget.openModal (chooser-widget.js:49:19) at HTMLButtonElement.<anonymous> (chooser-widget.js:35:14) at HTMLButtonElement.dispatch (jquery-3.6.0.min.js?v=c6ddc72d:2:43003) at v.handle (jquery-3.6.0.min.js?v=c6ddc72d:2:40998)