https://github.com/one-com/knockout-dragdrop
A drag and drop binding for Knockout.
https://github.com/one-com/knockout-dragdrop
Last synced: about 1 month ago
JSON representation
A drag and drop binding for Knockout.
- Host: GitHub
- URL: https://github.com/one-com/knockout-dragdrop
- Owner: One-com
- License: bsd-3-clause
- Created: 2013-09-25T07:08:48.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2018-02-02T05:09:54.000Z (over 7 years ago)
- Last Synced: 2025-04-02T11:06:00.967Z (about 2 months ago)
- Language: JavaScript
- Size: 771 KB
- Stars: 85
- Watchers: 27
- Forks: 29
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# knockout-dragdrop
A drag and drop binding for Knockout.
[Click here to see an example](http://one-com.github.io/knockout-dragdrop/examples/)
## Install
### NPM
`npm install knockout-dragdrop`
### Bower
`bower install knockout-dragdrop`
## Usage
Dragging between two lists:
```html
Drag from here
Drop here
```
```js
var model = {
source: ko.observableArray([
'Declan',
'Tessa',
'Claire',
'Violet',
'Alice',
'Mia',
'Camille',
'Aiden'
]),
target: ko.observableArray(),
drop: function (data, model) {
model.source.remove(data);
model.target.push(data);
}
};
ko.applyBindings(model);
```
## Running the example locally
Run the following command:
```
npm install && bower install && serve
```
and open [http://localhost:3000](http://localhost:3000) in your browser.
## License
Knockout.dragdrop is licensed under a standard 3-clause BSD license -- see the `LICENSE`-file for details.