Skip to content

Commit 86267ad

Browse files
authored
Merge pull request #371 from hvianna/master
Allow custom data in ul datasource
2 parents 6028527 + cd4cfc2 commit 86267ad

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)