nestedSortable icon indicating copy to clipboard operation
nestedSortable copied to clipboard

Prefix for item is forced since 2.0

Open eweso opened this issue 7 years ago • 0 comments

Line 775 - 797

` id = ($(item).attr(o.attribute || "id") || "").match(o.expression || (/(.+)-=_/));

if (depth === sDepth) { pid = o.rootID; } else { parentItem = ($(item).parent(o.listType) .parent(o.items) .attr(o.attribute || "id")) .match(o.expression || (/(.+)-=_/)); pid = parentItem[2]; }

if (id) { var data = $(item).children('div').data(); var itemObj = $.extend( data, { "id":id[2], "parent_id":pid, "depth":depth, "left":_left, "right":right } ); ret.push( itemObj ); } `

The problem here is the expression and the usage of id[2]. Because of id[2], you always have to define a prefix, because if you don't, you can only access id[1] and not id[2], which is not existing. The expression "(/(.+)-=_/)" should be "(/.+-=_/)". And instead of using id[2], you should use id[1]. This would allow me to use another attribute like "data-id" with the id as a value, without an "item-" prefix.

Sorry fot not pulling a request, but at the moment I not not have capacity for this.

eweso avatar Oct 23 '18 10:10 eweso