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

loosing borders in selectize widget after pressing button "Reset to initial" in bootstrap mode #122

Closed
amikphoto opened this issue Mar 16, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@amikphoto
Copy link

I've a form with selectize widget (foreing key). When the form is opened I press on "Reset to initial" button this fiels loosing border and style. Is it bug?

@lsmoker
Copy link

lsmoker commented Mar 25, 2024

I am also seeing an error when doing this. The SelectizeMultiple widget becomes inactive after clicking the Reset button. The console prints "Bad Request: my_url_path". The problem appears to be in formset/collection.py -

path = field_path.split('.', 1)

The field_path value is in the format:
books.0.book.authors

So the path var becomes 0.book.authors which causes an error since that field can't be found.

The collection/form nesting looks like this (from top to bottom):
LibraryCollection which includes
BookCollection which includes
BookForm which includes a SelectizeMultiple widget for authors

@jrief
Copy link
Owner

jrief commented Mar 25, 2024

Thanks for reporting. I'll have a look at this.

@jrief jrief added the bug Something isn't working label Mar 25, 2024
@jrief
Copy link
Owner

jrief commented Mar 26, 2024

@amikphoto I just tested on the demo page. What I see here, after clicking "Reset to initial" the field named "Static Opinion" forgets about all its options. However, I do not see the field losing its borders. How can I reproduce this?

@jrief jrief closed this as completed in bde4b42 Mar 26, 2024
@jrief jrief reopened this Mar 26, 2024
@jrief
Copy link
Owner

jrief commented Mar 26, 2024

I now fixed the problem with Reset on the Selectize widget with "Static Opinion".

However, I am not able to reproduce the field losing its borders.

@amikphoto
Copy link
Author

Thank you very much for your work!
But finally It seems to me the main problem of Selectize widget is in formset collections.
When I try to use Selectize widget in form collection and when I start input letters for serach in the form I have the same problem as Lsmoker . The same problem is when I press "Reset to initial". I can't say exactly but it seems to me the problem is the reason of loosing css style (borders).

@jrief
Copy link
Owner

jrief commented Mar 27, 2024

But finally It seems to me the main problem of Selectize widget is in formset collections.

This was the missing information. Now I am able to reproduce this myself.

@amikphoto
Copy link
Author

But finally It seems to me the main problem of Selectize widget is in formset collections.

This was the missing information. Now I am able to reproduce this myself.
I'm sorry to disturd you but just ask :) Did you find the problem? Could I hope to use Selectize in collections soon?

jrief added a commit that referenced this issue Mar 29, 2024
@jrief jrief closed this as completed in 9889ec4 Mar 29, 2024
jrief added a commit that referenced this issue Mar 29, 2024
@jrief
Copy link
Owner

jrief commented Mar 29, 2024

I'm sorry to disturd you but just ask :) Did you find the problem? Could I hope to use Selectize in collections soon?

I just pushed a working solution. I have to fix some unit tests before releasing a new version.

@amikphoto
Copy link
Author

Thank you very much!

@amikphoto
Copy link
Author

Still have the problem with new release 1.3.9. It happened when I use selectize widget and when I use active search in the widget and it tries to get answer from backend to get new list of options.

The problem appears in:

class FormCollection(BaseFormCollection, metaclass=FormCollectionMeta):
"""
Base class for a collection of forms. Attributes of this class which inherit from
django.forms.forms.BaseForm are managed by this class.
"""
def get_field(self, field_path):
path = field_path.split('.', 1)
key, path = path
return self.declared_holders[key].get_field(path)

image

self.declared_holders[key].get_field(path) return KeyError:'0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants