Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix for item is forced since 2.0 #127

Open
eweso opened this issue Oct 23, 2018 · 0 comments
Open

Prefix for item is forced since 2.0 #127

eweso opened this issue Oct 23, 2018 · 0 comments

Comments

@eweso
Copy link

eweso commented Oct 23, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants