Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirmation popup before aftermove is executed #196

Open
mrshawn191 opened this issue May 9, 2018 · 1 comment
Open

Confirmation popup before aftermove is executed #196

mrshawn191 opened this issue May 9, 2018 · 1 comment

Comments

@mrshawn191
Copy link

Hi I have this piece of code

			<div class="query-result" data-bind="onWindowResize: 218">
				<ul class="nav nav-pills nav-stacked" data-bind="sortable: { template: 'query-result-item-template', aftermove: reorder, data: $page.child('read')().children }">
				</ul>
			</div>

Its a list, and everytime you move each item a function reorder is executed.

My question is it possible to add a confirmation popup before the reorder function is executed? I want to warn the user about the action he is going to perform.

@mrshawn191 mrshawn191 changed the title Confirmation popup Confirmation popup before aftermove is executed May 9, 2018
@derrickb
Copy link

derrickb commented Jul 8, 2018

You can use the beforeMove handler and set arg.cancelDrop to true if the user wishes to cancel the move.

ko.bindingHandlers.sortable.afterMove = function (arg, event, ui) {
  //show popup, get user response, set arg.cancelDrop accordingly
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants