-
-
Save gokatz/c4bb367bc9fbf64fcd163e3b1687d53b to your computer and use it in GitHub Desktop.
each draggable
This file contains 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 Ember from 'ember'; | |
const { get } = Ember; | |
export default Ember.Component.extend({ | |
classNames:['drag-item'] | |
}); |
This file contains 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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
model: [1,2,3], | |
init() { | |
this._super(...arguments); | |
this.set('status', 'wait until swapping'); | |
Ember.run.later(this, function() { | |
//the below line is to simulate drag n drop sort | |
$('.drag-item:eq(0)').after($('.drag-item:eq(2)')); | |
this.setProperties({ show: true, status: 'swapping done, now try to remove 1'}); | |
let i = this.get('model.2'); | |
console.log(i); | |
this.get('model').removeObject(i); | |
console.log(this.get('model')); | |
Ember.run.scheduleOnce('render', this, () => { | |
this.get('model').insertAt(1, i); | |
console.log(this.get('model')); | |
}); | |
}, 3000); | |
}, | |
actions :{ | |
removeObject(item) { | |
alert(item); | |
this.get('model').removeObject(item); | |
} | |
} | |
}); | |
This file contains 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.7.2", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.4.4", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js", | |
"ember-template-compiler": "2.4.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment