難以調試這一個。jQuery UI Droppable未捕獲類型錯誤
在使用CoffeeScript的Backbone應用程序中使用jQuery UI Droppable。
功能沒有問題,一切工作都是按照我的意圖進行的,但每次丟棄項目時我仍然收到這個控制檯錯誤。
Uncaught TypeError: Cannot read property 'options' of undefined
代碼可投放:
@$el.droppable
tolerance: 'pointer'
hoverClass: 'drop_hover'
accept: '.item'
drop: (e, ui) =>
draggedItem = ui.draggable
itemId = draggedItem.attr 'data-id'
allInstances = @model.collection.models
findItems = for instance in allInstances
instanceItems = instance.get 'items'
instanceItems.getByCid itemId
compacted = _.compact findItems
droppedItem = compacted[0]
droppedCollection = droppedItem.collection
droppedCollection.remove droppedItem if _.include droppedCollection.models, droppedItem
@itemCollection.add droppedItem unless _.include @items, droppedItem
就像我說的功能是否正常工作,我只是想擺脫錯誤的,如果有人知道什麼是我可以試着調試。
堆棧跟蹤
Uncaught TypeError: Cannot read property 'options' of undefined
a.ui.plugin.add.stopjquery-ui.js:49
a.ui.version.a.extend.plugin.call jquery-ui.js:9
a.widget._trigger jquery-ui.js:49
a.widget._mouseStop jquery-ui.js:49
a.widget._mouseUp jquery-ui.js:28
a.widget._mouseUp jquery-ui.js:49
a.widget._mouseDown._mouseUpDelegate jquery-ui.js:28
f.event.dispatch jquery-1.7.1.min.js:3
f.event.add.h.handle.i jquery-1.7.1.min.js:3
感謝您的幫助。
是給你任何提示的錯誤的堆棧跟蹤? – dira 2012-03-20 12:42:47
對我沒有用處。我將它添加到問題中。 – mgaughan 2012-03-20 13:43:20
然後看起來像一個jQuery問題。看看這個http://forum.jquery.com/topic/on-draggable-destroy-uncaught-typeerror-cannot-read-property-options-of- undefined – dira 2012-03-20 14:23:56