102
Views
8
Comments
Solved
[ZTree Reactive] zTree reactive font color and font width
ztree-reactive
Reactive icon
Forge asset by Pedro Neto

Hi All,

I am facing a problem where i need to set font color  and font width to the child nodes,

can anyone suggest me what can i do here,


Can someone help here.


Thank you,

saikumar Appana.


2021-03-18 21-03-15
Benjith Sam
 
MVP
Solution

Hi Saikumar,

To make it work, a slight code change is required in the component module. 

Code Change Path: zTreeReactive [module] > InitTreeAction [Client action] > InitTree [JS node]

JS Snippet:

function getFont(treeId, node) {
    return node.fontCSS ? JSON.parse(node.fontCSS) : {};
}

setting.view.fontCss = Object.keys(setting.view.fontCss).length ? setting.view.fontCss : getFont;


See this demo screen: zTree_Node_Styling

Refer to the attached oml

I hope this helps you!


Kind regards,

Benjith Sam

zTreePOC.oml
2021-02-23 06-08-57
Saikumar Appana

Thank You, Benjith bro.

It is working as Required.

2021-03-18 21-03-15
Benjith Sam
 
MVP

You're welcome, Sai

Glad to help you :)


Kind regards,

Benjith Sam

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Saikumar,

if you supply an oml with a ZTree example, I'm sure someone will take a look.

for me, first having to build a ZTree example from scratch, which I have not used yet, is too much work.

Dorine

2021-02-23 06-08-57
Saikumar Appana

Hi Dorine,

this is the sample OML I created, Now I need to add color to font(Child nodes).


Thank you,

Saikumar Appana.

zTreePOC.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP

thanx for the oml, 

I can't see how to make it work.  

I tried traditional as well, don't see it.  Maybe ask one of the authors of these components directly.

Dorine

2021-03-18 21-03-15
Benjith Sam
 
MVP
Solution

Hi Saikumar,

To make it work, a slight code change is required in the component module. 

Code Change Path: zTreeReactive [module] > InitTreeAction [Client action] > InitTree [JS node]

JS Snippet:

function getFont(treeId, node) {
    return node.fontCSS ? JSON.parse(node.fontCSS) : {};
}

setting.view.fontCss = Object.keys(setting.view.fontCss).length ? setting.view.fontCss : getFont;


See this demo screen: zTree_Node_Styling

Refer to the attached oml

I hope this helps you!


Kind regards,

Benjith Sam

zTreePOC.oml
2021-02-23 06-08-57
Saikumar Appana

Thank You, Benjith bro.

It is working as Required.

2021-03-18 21-03-15
Benjith Sam
 
MVP

You're welcome, Sai

Glad to help you :)


Kind regards,

Benjith Sam

UserImage.jpg
João Beja

Hi @Benjith Sam ,

I have a question regarding the Ztree Demo for Traditional Apps. In the demo, we're able to insert the following string into a certain structure:

ztreeSettingsView.ztreeSettingsView.fontCss = "function (treeId, node) {return node.fontCSS ? JSON.parse(node.fontCSS) : {};}"

This assignment validates the `fontCss` parameters in the node.

I've attempted to replicate this in a reactive app, but unfortunately, it doesn't seem to work. I consistently receive the following error: 

"Unexpected token 'u', ..."fontCss":function(tr"... is not valid JSON."

Upon investigation, it seems that the issue stems from the code present in `zTreeReactive.Controller.js`, specifically:

Do you have any insights on how to resolve this? I'm considering using the alternative solution you mentioned, although this isn't the only app utilizing `zTreeReactive` within the company. Therefore, I'm exploring other potential methods to address this issue.

Thanks!

2021-03-18 21-03-15
Benjith Sam
 
MVP

Hi @João Beja,

Sharing your OML with the implemented code would be helpful for us to investigate and suggest a solution.

Additionally, since the OP already marked the post as a solution, creating a new post and attaching the oml, while linking to this post for reference, would be beneficial for the community and the asset team to offer assistance and explore alternative solutions.


Kind regards,

Benjith Sam

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.