sqisher / virtual-select Goto Github PK
View Code? Open in Web Editor NEWA searchable, themable, lazy-loading select component capable of handling thousands of options very efficiently
License: MIT License
A searchable, themable, lazy-loading select component capable of handling thousands of options very efficiently
License: MIT License
For the following browsers:
Subj.
Also, it's generally a good idea to have demo hosted somewhere, at least on GitHub Pages, so people don't have to download whole repo to see how it works.
If a options.loadingIndicatorElement
is present, the element should be used instead of the default loading indicator while making sure that Angular bindings in combination with ng-virtual-select keep working.
And remove the ui prefix while you're at it.
The data provider currently leaks way too many implementation details. The distinction between items
and availableItems
is confusing. The load
function forces the user to load all options into the memory. get
does nothing more than slicing the array which is public anyway, etc.
Maybe it makes sense to merge get, load and filter into one function:
{
totalItemCount: 0,
filteredItemCount: 0,
preload: function() { // optional
// preload all the necessary data
// return a promise that gets resolved when done
},
get: function(query, offset, length) {
// perform in-memory filtering or make a backend request
// update totalItemCount and filteredItemCount accordingly
// return a promise resolving to the requested subset of data
},
displayText: function(item, extended) {}, // optional
identity: function(item) {}, // optional
}
This way get
would become much more versatile, filtering becomes an implementation detail and preloading becomes optional.
However, when get
becomes asynchronous, we need to account for the fact that it could take much longer to load new data when scrolling. Maybe show loading indicator elements on the top and bottom of the option list, while the loading is in progress?
By entering the name of the new (non-existing) option and pressing enter.
Hi,
First of all I appreciate the work You're doing here. It will be nice to have clear button in input like in others select controls.
So that invalid or empty selections return this option instead of just null
.
And subsequently remove them from the repository.
Currently it's done in the constructor, which is too early, because most likely not all styles have been loaded at this point. The calculation should be delayed until the value is actually needed. In other words: when the option list gets shown.
Obvious candidates are identity
, displayText
and filter
.
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.