New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Play with components #19
Comments
Hi, Can you post your code? |
The code is really basic as
And the DraggableTable component as own template and actions. So when I drag/drop the DraggableTable to the playground, it whill copy the dom of the component, not the component itself. So, call action from the DraggableTable component iside the playground will call infact action inside the original one. Drap/drop events give only dom elements. And I do not know the way to retrieve a component instance from a dom element. So, I am considering to play with lists, and use component only for visual stuff. |
Would it help if I passed the ember object instance as argument for the Regards, On Thu, Apr 21, 2016 at 8:10 PM, Quentin Gerodel notifications@github.com
|
It depend of the Ember object we talk about. In this case, I request the |
//app/utils.js
export const getComponentFromId = (id) => {
return FrontEmber.__container__.lookup('-view-registry:main')[id];
};
export const getComponentFromEl = (el) => {
return getComponentFromId(el.id);
}; //app/editor/controller.js
//[...]
didDrop(el, target) {
let table = getComponentFromEl(el),
playground = getComponentFromEl(target);
playground.tables.addObject(table.model);
Ember.$(el).remove();
}
//[...] Give me all I need. Thanks for your time. |
Hi,
I want to use ember-dragula in a project.
But, I use dragula to copy element from a deck to a workbench.
Each element is an ember component and deal with own actions.
Unfortunatly, dragula copy all the DOM without the component logic.
When I call an action from a component inside the workbench, the component emitter is finally the deck one.
So, How can I use ember-dragula to create an unique component after copying ?
Thanks for advance,
The text was updated successfully, but these errors were encountered: