The Wayback Machine - https://web.archive.org/web/20201219203921/https://github.com/dabeng/OrgChart/issues/585
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

Can't use className when using UL as datasource #585

Open
ghost opened this issue Sep 23, 2020 · 1 comment
Open

Can't use className when using UL as datasource #585

ghost opened this issue Sep 23, 2020 · 1 comment

Comments

@ghost
Copy link

@ghost ghost commented Sep 23, 2020

It appears that you can't make data-* attributes contain capital letters -- they'll be lowered by default. As a result, if you add a data-className attribute to a li they key will become classname when parsing the UL to a json datasource. This makes it so that className for color coding the chart isn't a usable feature when using a UL as a datasource.

I can think of 2 solutions off-hand....

  1. modify the options to add className with a default value of "className" and use whatever the value is set to grab and append the additional classes to the node (more involved, but doesn't require any change to examples)
  2. just change className to classname (less involved, but will break any existing examples that rely on className having a capital N)
@ghost
Copy link
Author

@ghost ghost commented Sep 23, 2020

I'm using the following work around in the mean time

'createNode': function ($node, data) {
    if (data.classname !== undefined && !$node.hasClass(data.classname)) {
        $node.addClass(data.classname);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
0 participants
You can’t perform that action at this time.