question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trouble Styling Nodes

See original GitHub issue

I’m using this for a simple dynamic tree that the user can add and subtract nodes from and I’ve been trying to create my own custom styling, but it doesn’t seem to be overriding any of the other styles. I’ve tried adding classes to the selector as well, but it doesn’t seem to work.

CSS #mytree{ background-color: red!important; }

HTML in Component

<tree-root id="mytree" [nodes]="nodes" [options]="options">
    <template #treeNodeTemplate let-node="node" let-index="index">
        ...html content...
    </template>
</tree-root>

I’m linking it to my component via the styleUrls. My goal is to color code the background color of some of the nodes.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gRoussaccommented, May 26, 2017

@Hesesses, did you wrap you css into a deep rule ? Because I believe styling is on sub components right ?

#{$deep} {
  .tree-node {
...
    .node-content-wrapper {
...
    }
  }
}

Regards

1reaction
dojchekcommented, Mar 15, 2017

@Edge1039 I needed the same the other day, here’s how it can be done:

<template #treeNodeTemplate let-node="node">
    <div [ngClass]="getNodeClass(node)">
        { node.data.name }}
    </div>
</template>

Then, you can put any kind of styling logic in getNodeClass(node) method, like this for example:

getNodeClass(node: ITreeNode): string {
    if (node.data.disabled) {
      return 'tree-node tree-node-disabled';
    }
    return 'tree-node';
}

In the end, you just have to define your styles - Here’s my scss:

.tree-node{
    color: darken($text-color, 20);
}
.tree-node.tree-node-disabled {
    color: lighten($text-color, 20);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble Styling Nodes · Issue #212 - GitHub
I'm using this for a simple dynamic tree that the user can add and subtract nodes from and I've been trying to create...
Read more >
problem styling all nodes (table rows) in a table across ...
i am using DataTables plug-in inside a form for multiple row selection.
Read more >
Styling span textnode without styling child nodes
So I'm creating a theme plugin for a forum where users often enter text with custom coloring. This is implemented as an inline...
Read more >
New color styling options with [TH] Nodes - ThemeHouse
Ian from ThemeHouse shows off the new styling options with the latest version of the [TH] Nodes add-on for XenForo 2.
Read more >
[TH] Nodes for grid, custom styling, and custom icons - XenForo
[TH] Nodes for grid, custom styling, and custom icons 1.1.1 Patch Level 1 · Navigate to a forum or sub-forum faster by clicking...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found