Giter Club home page Giter Club logo

anchosen's People

Contributors

kastermester avatar thetrompf avatar

Watchers

 avatar

Forkers

thetrompf secoya

anchosen's Issues

Better feedback when entering an already selected option

If the user enters text that matches an already selected option, showing this to the user instead of the fact that no such item exists in the list of available options would make alot of sense. Especially when Anchosen is being used with the 'create new' capabilities - as otherwise the user is now able to create a new option with the same content as an old option.

Changes to when the available options auto completion list is shown

Currently the list is always shown when there's focus in the input field - assuming there's any options left to choose from.

In order to be more user friendly, the auto completion list should be shown when all of the following are true

  • The Anchosen is enabled
  • The field is focused
  • A single selection is allowed
  • There are options left to choose from

All of the above is the way it is currently implemented, like so:

@availableOptionsVisibleNoThrottle = ko.computed(() =>
    @enabled() && @searchFieldFocused() && @singleSelectionAllowed() && @options().length > 0
)

An extra requirenment to add to the list would be that either of the following are true:

  • The entered search string is not empty
  • An item in the list is highlighted (accomplished with up/down keys)

And a final step would be to add a feature where by holding down ctrl (on windows + linux) or command (osx) will ensure that the list stays open after a successful selection has been made.

Improve build script & ease debugging

The build script is currently a bit buggy. The package.json file lists some dependencies - however the dependencies are required to be installed as a global package in npm. Some relative binary paths should be used.

Especially the building of jquery is quite buggy at this point and doesn't seem to work in Windows at all.

At the same time, it would be very nice if we could add our own node web-server to ease development. Perhaps this server could even compile coffeescript and less files on the fly.

Restructure anchosenSearchField binding

Currently the binding assumes a whole lot about the ViewModel that it is being bound against.

It would be very neat if all these methods that the binding calls are being passed in from the Knockout template into the binding - instead of simply assuming that these exists. It is code like the following that is annoying me:

$el.bind 'keydown.anchosen', (e) ->
    switch e.keyCode
        when UPARROW
            e.preventDefault()
            viewModel.highlightPrevious()
        when DOWNARROW
            e.preventDefault()
            viewModel.highlightNext()
        when BACKSPACE
            if value() == ''
                if viewModel.lastSelectedIsMarked()
                    viewModel.deselectLast()
                else
                    viewModel.lastSelectedIsMarked true

A syntax like the following would be nice:

<input type="text" bind="anchosenSearchField: { text: searchString, highlightNext: highlightNext, highlightPrevious: highlightPrevious, deselectLast: deselectLast, lastSelectedIsMarked: lastSelectedisMarked }">

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.