Last active
January 27, 2020 23:46
-
-
Save validkeys/64df3180660c8d3e58830a3d532e5370 to your computer and use it in GitHub Desktop.
Ember Sortable not working in overflow auto container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Controller from "@ember/controller"; | |
| import { set } from "@ember/object"; | |
| import { sort } from "@ember/object/computed"; | |
| export default Controller.extend({ | |
| init() { | |
| this._super(...arguments); | |
| this.set("sortOrder", ["order:asc"]); | |
| }, | |
| sortedItems: sort("model", "sortOrder"), | |
| actions: { | |
| sortItems(items) { | |
| items.forEach((item, idx) => { | |
| set(item, "order", idx); | |
| }); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Route from "@ember/routing/route"; | |
| export default Route.extend({ | |
| model() { | |
| return [ | |
| { id: 1, order: 0, title: "A" }, | |
| { id: 2, order: 1, title: "B" }, | |
| { id: 3, order: 2, title: "C" }, | |
| { id: 4, order: 3, title: "D" }, | |
| { id: 5, order: 4, title: "E" }, | |
| { id: 6, order: 5, title: "F" }, | |
| { id: 7, order: 6, title: "G" }, | |
| { id: 8, order: 7, title: "H" }, | |
| { id: 9, order: 8, title: "I" }, | |
| { id: 10, order: 9, title: "J" } | |
| ]; | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * { | |
| box-sizing: border-box; | |
| } | |
| .outter { | |
| display: flex; | |
| border: red 1px solid; | |
| width: 350px; | |
| flex-direction: column; | |
| padding: 5px; | |
| max-height: 500px; | |
| } | |
| .inner { | |
| flex: 1 1 auto; | |
| overflow: auto; | |
| } | |
| .card { | |
| padding: 20px; | |
| background: red; | |
| color: white; | |
| margin: 5px 0px; | |
| width: 100%; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.15.1", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
| "ember": "3.4.3", | |
| "ember-template-compiler": "3.4.3", | |
| "ember-testing": "3.4.3", | |
| "ember-sortable":"2.1.2" | |
| }, | |
| "addons": { | |
| "ember-data": "3.4.2", | |
| "ember-sortable":"2.1.2" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment