jquery-ui-sortable

Jquery UI - Sortable add class on update

爷,独闯天下 提交于 2021-02-10 05:53:35
问题 I'm using jqueries UI sortable plugin with 2 connected lists. I'm trying to get sortable to add a certain class to the li when it is dropped into certain uls. So depending on the ul it goes to, I want it to remove the old class and add a new different class which will be ul dependent. For example: I have a complete list and a archived list. I want it to change classes when moving from completed to archive and vice versa. I did some research and found: receive: function(event, ui) { //Element

Jquery UI - Sortable add class on update

邮差的信 提交于 2021-02-10 05:53:06
问题 I'm using jqueries UI sortable plugin with 2 connected lists. I'm trying to get sortable to add a certain class to the li when it is dropped into certain uls. So depending on the ul it goes to, I want it to remove the old class and add a new different class which will be ul dependent. For example: I have a complete list and a archived list. I want it to change classes when moving from completed to archive and vice versa. I did some research and found: receive: function(event, ui) { //Element

Updating sort order during sort change event - jQuery UI

こ雲淡風輕ζ 提交于 2021-02-07 18:53:33
问题 I want the value of the list element to be the index of the sorted position during sort event. This value should update automatically during sort change event. <script type="text/javascript"> $(function() { $('#sortable').sortable({ start : function(event, ui) { var start_pos = ui.item.index(); ui.item.data('start_pos', start_pos); }, change : function(event, ui) { var start_pos = ui.item.data('start_pos'); var index = ui.placeholder.index(); if (start_pos < index) { $('#sortable li:nth-child

Sortable with dynamic content

谁说胖子不能爱 提交于 2021-02-05 10:49:07
问题 So I use jQuery UI sortable plugin to sort photos in a small gallery. $(function() { $("#area").sortable({ items: '.sort-wrapper', cursor: "move", handle: ".photo-handler", opacity: 0.5, scroll: true, scrollSensitivity: 100, scrollSpeed: 5, revert: 100, tolerance: "pointer", update : function () { var order = $('#area').sortable('serialize'); $.ajax({ type : 'POST', url : '/file.php', data : order }); } }).disableSelection(); On the same page I dynamically add and remove photos. PHP script

Cypress Drag and drop test

落爺英雄遲暮 提交于 2021-01-29 07:09:05
问题 I would like to test the sortable table with Cypress.io I follow their page instruction: https://docs.cypress.io/api/commands/trigger.html#Mouse-Events and it doesn't work... First: it doesn't move the element Second: when I see the step by step test on the left side, mouse down and mouse move are located in the same position... my test cy.get('.resource-filter-table') .trigger('mousedown', {witch:1, pageX:188, pageY:196}) .trigger('mousemove', {witch:1, pageX:188, pageY:261}) .trigger(

Jquery Drag drop - One list with sortable and other list with draggable & droppable without sort

冷暖自知 提交于 2021-01-28 06:00:42
问题 I am trying to drag drop items between two lists, My requirements are, List A (with drag and drop to List B but not sortable) item 1 item 2 item 3 List B (with sortable and drag/drop to List A) item 4 item 5 item 6 i tried the .sortable() , but it makes the List A with sortable functionality, <ul id="sortable1" class="connectedSortable"> <li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item

How to fix “This repository can be attached only to ORM sortable listener” error in Gedmo sortable?

空扰寡人 提交于 2021-01-27 05:24:17
问题 When usieing StofDoctrineExtensions (which is a Symfony2 port of Gedmo Doctrine Extensions) Sortable behaviour I kept on getting this error: This repository can be attached only to ORM sortable listener Since I could not easily find the answer in official docs I'm leaving an answer here for future reference. 回答1: You need to enable any listeners you are using. In this case, Sortable. stof_doctrine_extensions: default_locale: en_US orm: default: sortable: true For Symfony 4, add this

How to fix “This repository can be attached only to ORM sortable listener” error in Gedmo sortable?

一个人想着一个人 提交于 2021-01-27 05:23:31
问题 When usieing StofDoctrineExtensions (which is a Symfony2 port of Gedmo Doctrine Extensions) Sortable behaviour I kept on getting this error: This repository can be attached only to ORM sortable listener Since I could not easily find the answer in official docs I'm leaving an answer here for future reference. 回答1: You need to enable any listeners you are using. In this case, Sortable. stof_doctrine_extensions: default_locale: en_US orm: default: sortable: true For Symfony 4, add this

How can I save SortableJS positions to an object? [duplicate]

心不动则不痛 提交于 2020-12-13 03:35:18
问题 This question already has answers here : Convert Array to Object (45 answers) Closed 18 days ago . I am trying to create a questionnaire where users rank images from favourite to least. I am using the SortableJS so the images can be dragged and dropped. I have the position of the images currently in the console.log. However, I am trying to push it to a dictionary so it could be formatted as: {0 : image2, 1:image1, 2:image3} . This would allow me to see what image is at each index, so when the

How do you perform a reset on a JQuery Sortable

只谈情不闲聊 提交于 2020-11-30 11:55:46
问题 I'm using JQuery Sortable. I'd like to know if it's possible to, after a number of resortings, restore the sortable control back to its original state similar to a form reset. The 'cancel' option only seems to affect the last sort attempt not all of them. 回答1: I personally like doing it this way: $("#sortable").sortable({config...}); var cache = $("#sortable").html(); On Reset $("#sortable").html(cache).sortable("refresh"); I tried using .clone() and.children() and even $("#sortable > *), but