【问题标题】:Jquery nestedSortable: Uncaught TypeError: Cannot read property 'match' of undefinedJquery nestedSortable:未捕获的类型错误:无法读取未定义的属性“匹配”
【发布时间】:2017-02-14 15:15:59
【问题描述】:

这是小提琴:https://jsfiddle.net/107bx70o/3/

var ns = $('ol.sortable').nestedSortable({
    forcePlaceholderSize: true,
    handle: 'div',
    helper: 'clone',
    items: 'li',
    opacity: .6,
    placeholder: 'placeholder',
    revert: 250,
    tabSize: 25,
    tolerance: 'pointer',
    toleranceElement: '> div',
    maxLevels: 3,
    isTree: true,
    expandOnHover: 700,
    startCollapsed: false,
    change: function() {
        console.log('change');
    },
    sort: function() {
        console.log('sort');
    },
    relocate: function() {
        console.log('relocate');
    }
});

$('#toArray').click(function(e) {
    arraied = $('ol.sortable').nestedSortable('toArray', {startDepthCount: 0});
})

单击按钮时,您会收到错误消息。

我也尝试过 github 上的最新版本:https://github.com/ilikenwf/nestedSortable

但是错误是一样的。我的代码和 Fiddle 完全一样。

【问题讨论】:

    标签: javascript jquery jquery-ui jquery-ui-sortable


    【解决方案1】:

    您只是错过了将 ids 设置为 li menu

    <li id="menuItem_1"> ....</li>
    

    这是Fiddle的工作

    【讨论】:

      猜你喜欢
      • 2014-06-14
      • 2021-08-16
      • 1970-01-01
      • 1970-01-01
      • 2021-12-22
      • 2015-01-06
      • 2017-07-26
      • 1970-01-01
      相关资源
      最近更新 更多