question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

any examples for storing the remove events and add events?

See original GitHub issue

Hi,

I have tried the store options, it works, but how can I save even after I remove or add items? plz advise.

My code:

var tagOrder = new Sortable(tagEle, {
            animation: 150,
            filter: ".js-remove",
            ghostClass: "sortable-ghost",
            onFilter: function (evt) {
                var el = tagOrder.closest(evt.item);
                el && el.parentNode.removeChild(el);
            },
            group: 'tags-list',
            store: {
                get: function (sortable) {
                    var order = localStorage.getItem(sortable.options.group);
                    console.log(localStorage.getItem(sortable.options.onFilter));
                    return order ? order.split('|') : [];
                },
                set: function (sortable) {
                    var order = sortable.toArray();
                    localStorage.setItem(sortable.options.group, order.join('|'));
                }
            }
        });

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
RubaXacommented, Dec 16, 2014

Try dev-branch: https://github.com/RubaXa/Sortable/tree/dev#save

onFilter: function (evt) {
   evt.from.removeChild(evt.item);
   tagOrder.save(); //  <--- Save the current sorting
},
0reactions
jackyoncommented, Dec 17, 2014

oh, sorry, I thought there was an option to save the remove items on localStorage also.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window: storage event - Web APIs | MDN
The storage event of the Window interface fires when a storage area (localStorage) has been modified in the context of another document.
Read more >
Add, modify, or delete events in Calendar on Mac
Add, modify, or delete events in Calendar on Mac. Use the Calendar app to schedule meetings, appointments, family activities, and other events.
Read more >
Removing events · Issue #557 · RailsEventStore ... - GitHub
Hi, We're started using you amazing library to publish and store several events but I just realized there are some of them which...
Read more >
Handling and Raising Events | Microsoft Learn
The following example shows how to declare an event named ThresholdReached . The event is associated with the EventHandler delegate and ...
Read more >
Removing an anonymous event listener - Stack Overflow
There is no way to cleanly remove an event handler unless you stored a reference to the event handler at creation. I will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found