GithubHelp home page GithubHelp logo

Comments (6)

jrief avatar jrief commented on June 10, 2024

I just tested here: https://django-formset.fly.dev/bootstrap/state

If I type "son", many counties ending with …son are found. If I type "ky" many counties in Kentucky are found. Yes, it's true that tom-select applies its own filter, but so at least it highlights the matching string.

Do you see any possibility in removing stifer.js, while initializing tom-select?

from django-formset.

Actionb avatar Actionb commented on June 10, 2024

I just tested here: https://django-formset.fly.dev/bootstrap/state

If I type "son", many counties ending with …son are found. If I type "ky" many counties in Kentucky are found. Yes, it's true that tom-select applies its own filter, but so at least it highlights the matching string.

When both the back-end and the front-end do the same filtering, then there isn't an issue. The issue arises when the front-end filters differently from the back-end. In the example I gave, the back-end queries two fields (name and code) and returns a result if the values of either of them matches the search term. But the front-end only gets the data of the name field and will apply its filter only against that data.

That means, if you want to find a state based on its code, and you don't include the code values in the options passed to the response such that it is available to sifter (and, of course, if the state's code isn't similar to its name), then you won't find anything.

Another example where I anticipate this could be an issue is full text search and other kinds of similarity searches, because of the normalization applied to the data and the search term that isn't apparent to the front-end.
Though I suppose, you should provide search result highlighting wherever possible so that the user isn't confused about the results - which would then let sifter find the results - it's still odd to have sifter needlessly apply its own filter on top of already filtered results.

Do you see any possibility in removing stifer.js, while initializing tom-select?

Setting searchField to an empty list seems to remove the filtering aspect while retaining the match highlighting: https://jsfiddle.net/o3xshkLc/
Seems like the best of both worlds? I don't have the faintest clue how to set that within the django-formset script though.

from django-formset.

jrief avatar jrief commented on June 10, 2024

Setting searchField to an empty list seems to remove the filtering aspect while retaining the match highlighting

That could be achieved easily by adding an extra attribute to the Selectize widget. Any proposal how to name this?

from django-formset.

Actionb avatar Actionb commented on June 10, 2024

Wouldn't it be better to just generally set searchField to an empty list if a search_lookup is provided to the widget? Because when search_lookup is set, IncompleteSelectResponseMixin._fetch_options already does the filtering and sifter's second filtering isn't ever needed. Or am I missing something?

from django-formset.

jrief avatar jrief commented on June 10, 2024

Wouldn't it be better to just generally set searchField to an empty list if a search_lookup is provided to the widget?

I will try and check if the UX remains the same.

How important is this for you now, or can this feature wait a little bit?

from django-formset.

Actionb avatar Actionb commented on June 10, 2024

I can wait.

Is there a way to re-initialize an 'selectize' element with the appropriate searchField value? Doesn't have to be pretty, just a bit of javascript that I can slap into a script block to test things out perhaps? It seems like such a small thing, but I can't figure out how to do it for django-formset.

from django-formset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.