bevacqua / angularjs-dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/angularjs-dragula
MIT License
509 stars 110 forks source link

Save position #119

Open bokrizan opened 6 years ago

bokrizan commented 6 years ago

Is there any way to store custom position to the base, so when the user next time login, the position of the box are not changed. I don't want to store position to local storage or cookie, I want to store position to API.

Shakell commented 6 years ago

@bokrizan Have some ideas now? I want make the same thing work.

bokrizan commented 6 years ago

first, you need to get all div id in order like on your web page (when you with dragula change position), and after, I push this ID in the array and send to the server var orderById = []; var orderDiv = $("#dragulaBox").children("div"); angular.forEach (orderDiv, function(key, value){ orderById.push(key.id); }) var data = {graphsConfig: orderById}; $http.post(someURL, data, config)

And, when you again come back to site, you get from your API array with order.