Comments (9)
Could you provide a jsfiddle? Or at least the line number the error is raised and a backtrace.
Then I will look into it.
from jquery-sortable.
Lemme give you a jsfiddle in 10 mins. Thanks!
from jquery-sortable.
Okay - its a "TypeError: $item is undefined"
from jquery-sortable.
Okay - here is the jsFiddle - http://jsfiddle.net/av6YU/1/
As you can see - this is working just fine. In my case, I am not really adding new elements but reloading the whole list elements again and this below line causes the error I posed above.
newOrder = $("ul.order_list").sortable("serialize").get();
If I comment the above line - it works without error - but then I do not get the updated list.
from jquery-sortable.
I'm having the same issue. I'm note able to use the onDrop function on nested lists, while it's working fine for plain lists. Any help will be much appreciated.
from jquery-sortable.
I think I have the same issue... I receive option with "undefined" value from a select field on which there is an heavilly customize bootstrap typehead activated...
Hard to say if it the same issue, since the jsfiddle doesn't seems to produce error, at least not mine.
Thanks
from jquery-sortable.
Here it is a jsfiddle with the issue: http://jsfiddle.net/MyyeY/1/
jQuery 1.9.1 and 1.10.1 return the following error: TypeError: $item is undefined
jQuery 2.0.2 returns error: too much recursion
- Removing
$.get
(or$.post
) call in onDrop action works with no errors. - Making the list plain (
nested: false
) works also (with$.get
/$.post
action defined).
from jquery-sortable.
For my part there is remaining undefined option in select once an option is dragged and dropped off... I don't use nested list only a simple ol with option added to a select that I map in to the ol. If there is option sorted I reconstruct the select form the ol li...
function redo_select() {
$('select[id="%(selSearch)s"]').empty();
$('#%(olSearch)s li').each(function(){
});
This is called here and there...
Like in the function below (though it actually commented because it wasn't work properly) :
function make_ol_sortable(){
var adjustment;
$('#%(olSearch)s').sortable({
group: 'simple_with_animation',
pullPlaceholder: false,
// animation on drop
onDrop: function (item, targetContainer, _super) {
var clonedItem = $('
item.before(clonedItem)
clonedItem.animate({'height': item.height()})
item.animate(clonedItem.position(), function () {
clonedItem.detach()
_super(item)
})
//redo_select(); // This not working for now there is option with undefined value that remain once the dragged option is released that seems a bug
},
// set item relative to cursor position
onDragStart: function ($item, container, _super) {
var offset = $item.offset(),
pointer = container.rootGroup.pointer
adjustment = {
left: pointer.left - offset.left,
top: pointer.top - offset.top
}
_super($item, container)
},
onDrag: function ($item, position) {
$item.css({
left: position.left - adjustment.left,
top: position.top - adjustment.top
})
}
});
I really don't know where it comes exactly, but I guess it comes from one of these functions :
clearOffsetParent: function () {
this.offsetParent = undefined
},
// Recursively clear container and item dimensions
clearDimensions: function () {
this.containerDimensions = undefined
var i = this.containers.length
while(i--){
this.containers[i].clearDimensions()
}
:)
from jquery-sortable.
either use sortable("refresh")
or sortable("destroy")
and reinit.
from jquery-sortable.
Related Issues (20)
- publish latest changes to npm HOT 1
- we can not use this other tag nested level
- Does not work with column-fill / feature request
- not working on mobile phone HOT 2
- After around ~30 drag&drop moves IE becomes very slow HOT 1
- MIT license?
- I can't sort items out of group
- reattach event handler after a jquery .html()
- Update required for jQuery 3.x - jQuery.fn.offset() requires an element connected to a document
- Unable to resort after using destroy
- Revert/undo a drop HOT 1
- Sortable handle, drag from the right, not the left
- Serialize option documentation is incomplete
- .sortable('toArray', {attribute: 'data-id')) returns a list of jQuery objects
- How to prevent child node to dragged in another parent node ... How to save Data to mysql and PHP HOT 2
- No longer works once upgrading jquery to 3.3.1
- what are the js/html/css for the first example?
- Example styling HOT 1
- Compatibility with Jquery UI sortable
- Not compatible with jquery 3.3.0+ HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-sortable.