kastermester / anchosen Goto Github PK
View Code? Open in Web Editor NEWThe other chosen
License: Other
The other chosen
License: Other
Right now the callback must return an object that can be used - maybe null/undefined should signal that the option was not created.
The ViewModel should be able to accept functions to test for item equality, sorting and searching - which should then be used around the view model to determine these core concepts.
When creating a new option - and then deselecting it, it will now appear in the list of available options. it would be nice to be able to control whether this happens or not.
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.
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
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:
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.
See http://jsfiddle.net/tsPRH/
In the bottom right Anchosen, enter some garbage text, like 'jkseh' and then blur the Anchosen. Now it will show "No results found for ''" and then the drop-box will disappear. The no results item should never be shown with an empty string.
If you make a search on an option, and get results, then the create new options, should still be an option if the search string isn't an exact match.
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.
There is a bug in the "Create New" functionality. When searching, and the search string is an exact match, the "Create New" box is still visible.
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 }">
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.