Skip to content

Commit cd4cfc2

Browse files
committed
Allow custom data in ul datasource
Adds support for custom data attributes in the ul datasource, that can be used in the custom node template.
1 parent 6028527 commit cd4cfc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/js/jquery.orgchart.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@
344344
'name': $li.contents().eq(0).text().trim(),
345345
'relationship': ($li.parent().parent().is('li') ? '1': '0') + ($li.siblings('li').length ? 1: 0) + ($li.children('ul').length ? 1 : 0)
346346
};
347-
if ($li.attr('data-id')) {
348-
subObj.id = $li.attr('data-id');
349-
}
347+
$.each($li.data(), function(key, value) {
348+
subObj[key] = value;
349+
});
350350
$li.children('ul').children().each(function() {
351351
if (!subObj.children) { subObj.children = []; }
352352
subObj.children.push(that.buildJsonDS($(this)));

0 commit comments

Comments
 (0)