ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Drag and Drop Sample
Title:
B
I
{code}
?
I see Drag and Drop sample (Cards and Items) I have some questions : 1) Is it possible to disable card dragging (leave only dragging items) 2) is there validation ? Is it possible to cancel the dragging ? es. I have 2 cards 1° with 5 items 2° with 10 items I have the rule that cards can't contain more 10 items. If I try to drag an item to 1° card to 2°, I have to show "card can't contain more 10 items" message, and refuse the drag
Save Changes
Cancel
Meccanica Rossi
asked at 24 Dec 2017
please have a look at the edited answer
at 26 Dec 2017
Omu
Answers
B
I
{code}
?
in this demo http://demo.aspnetawesome.com/DragAndDropDemo#Cards-and-Items 1) if you click on `show code` you'll see two calls to `awem.dragReor` one is for the items and another one is for the cards, so you can remove the one with `sel: '.card'` if you don't need to drag cards 2) here's an example that will revert the dragged object when you get more than 3 items $('#b1').on('awedrop', function (e, data) { var item = $(e.target); if (item.closest('.card').find('.item').length > 3) { if (!data.previ) { data.from.prepend(item); } else { data.from.find('.item').eq(data.previ - 1).after(item); } alert('sorry len > 3'); } });
Save Changes
Cancel
Omu
answered at 24 Dec 2017
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK