jeudi 29 octobre 2015

Set position of a Ember component as it is generated

I'm trying to make a drag and drop UI in my Ember app. A person has a component displaying various attributes.

I want the component to be dragged and positioned on a grid. The position the component is dragged to is then saved, as an attribute of the model. No problem.

My problem is that on loading the page, I want to position each component using those saved position attributes. The JQuery for positioning it etc I'm happy that I can work out, I just don't know where to put it.

My two thoughts are:

  1. Once the route has loaded, go through and reposition each of the components. (not the best sounding option)
  2. Is there an event specific to the successful generation of a component? Each component would then be created and positioned immediately in turn. Hopefully then I could maybe also pass in the position attribute. Any details or suggestions on this option would be much appreciated.

Thanks




Aucun commentaire:

Enregistrer un commentaire