I made dragging functionality, but stuck in something, cuz not pRo .
Source hereangularjs.
It's about smart-table directive from lorenzofox3
But point of question is dragging feature itself.
I know how to drag element, but the problem is that it's a <table>
with nested
<thead>
<tr>
<th>header</th>
</tr>
</thead>
<tbody>
<tr>
<td>text</td>
</tr>
</tbody>
And I wonder how steps should be done. Should I replace DOM element positions or just imitate. And also consider i must respectively replace table columns.
I need just steps(not solution) of full logic - what must happen when user
start-drags
move-drag
end-drag
.
Angular approach is not important. Just logic.
Answer from lorenzofox3
Hello,
I think your best bet is to have an associated model to your columns so that you can watch it, and especially when you reorder the collection (by drag n drop for example). Have a look at this example. Note to reorder the model collection with drag and drop I use lrDragNDrop if you are interested in the logic. The drawback with my simple example is that you lose flexibility on the cell templates, and you will have to elaborate a bit on this example if you want something more sophisticated.
regards,
Laurent