It is currently 26 January 2020, 20:02 Advanced search

How to change color of tree node?

Questions and answers on how to best use Instant Developer

How to change color of tree node?

Postby Girish » 23 August 2019, 12:48

Hello
I am using DO based tree, That tree basically show customers and in case of non active customer (db Field is there this purpose) i want to change node color to Red.
How to achieve this?
Thanks & Best Regards
Girish
User avatar
Girish
 
Posts: 12
Joined: 24 January 2019, 10:40

Re: How to change color of tree node?

Postby ljwilson » 23 August 2019, 13:31

Maybe this thread would help?
Html tags in Tree node

http://forum.instantdeveloper.com/viewtopic.php?f=7&t=61944&p=87933

...jack
ljwilson
 
Posts: 503
Joined: 26 November 2013, 14:15

Re: How to change color of tree node?

Postby Girish » 26 August 2019, 13:15

I am using DO based tree, it is not clear to me how to add expression to paint node in red color?
Please explain.

Thanks and Best Regards
Attachments
testimage.png
testimage.png (26.47 KiB) Viewed 963 times
User avatar
Girish
 
Posts: 12
Joined: 24 January 2019, 10:40

Re: How to change color of tree node?

Postby ljwilson » 26 August 2019, 14:39

Here is one way:

In this example I'm making the invoice #1 red.

2019-08-26_10-35-02.png
2019-08-26_10-35-02.png (76.8 KiB) Viewed 956 times


2019-08-26_10-35-29.png
2019-08-26_10-35-29.png (20.04 KiB) Viewed 956 times


...jack
ljwilson
 
Posts: 503
Joined: 26 November 2013, 14:15

Re: How to change color of tree node?

Postby Girish » 27 August 2019, 6:57

Thanks ljwilson
It worked well for root level but not for child level


I attach here sample to have a look.

Thanks & Best Regards
Girish
Attachments
child node.png
child node.png (18.35 KiB) Viewed 935 times
Testprg.7z
(290.35 KiB) Downloaded 56 times
User avatar
Girish
 
Posts: 12
Joined: 24 January 2019, 10:40

Re: How to change color of tree node?

Postby ljwilson » 27 August 2019, 13:43

Looks like a timing issue--the children are rendered before the html change is seen.

I took your example and converted the db to access, adding your example docs.
To get this:

2019-08-27_9-29-27.png
2019-08-27_9-29-27.png (24.19 KiB) Viewed 913 times


1. I commented-out the places in the form load event where the font color was changed:
2019-08-27_9-27-21.png
2019-08-27_9-27-21.png (129.37 KiB) Viewed 913 times


2. Added an After Load event to the class. This formats all docs whether child or not.
2019-08-27_9-30-11.png
2019-08-27_9-30-11.png (77.56 KiB) Viewed 913 times


Revised project using access db:
TestprgV2.zip
(491.03 KiB) Downloaded 55 times


I would probably add another property to the class, like DescriptionFormatted. That way you can edit just the description, but display the DescriptionFormatted. You wouldn't have to save DescriptionFormatted to the database--just have it as a non-linked property in the class.
ljwilson
 
Posts: 503
Joined: 26 November 2013, 14:15

Re: How to change color of tree node?

Postby Girish » 27 August 2019, 16:17

Thanks a lot ljwilson!
This is exactly what i wanted to achieve, however i noticed that description at panel side now have html code, how to have normal text here?.

Thanks & Best Regards
Girish
Attachments
test png.png
test png.png (32.93 KiB) Viewed 907 times
User avatar
Girish
 
Posts: 12
Joined: 24 January 2019, 10:40

Re: How to change color of tree node?

Postby ljwilson » 27 August 2019, 20:00

The nice thing about InDe is there are so many ways to do things. My original thought was:

I would probably add another property to the class, like DescriptionFormatted. That way you can edit just the description, but display the DescriptionFormatted. You wouldn't have to save DescriptionFormatted to the database--just have it as a non-linked property in the class.


But in going back and reviewing trees in the user guide, I realized I had forgotten about OnGetName.

So the easiest way is to
  1. Get rid of the AfterLoad Event.
  2. Put its logic in the OnGetName Event.
2019-08-27_15-50-13.png
2019-08-27_15-50-13.png (63.34 KiB) Viewed 897 times


Which gives you:
2019-08-27_15-49-48.png
2019-08-27_15-49-48.png (25.63 KiB) Viewed 897 times


TestprgV3.zip
(491.26 KiB) Downloaded 55 times

...jack
ljwilson
 
Posts: 503
Joined: 26 November 2013, 14:15

Re: How to change color of tree node?

Postby Girish » 28 August 2019, 6:30

Hi ljwilson
Thanks a lot for you help!

In fact i also tried to implement additional property idea at class side by having HTML_Description field so Right side panel would display "Description" field and tree would display "HTML_Description", but i stuck on how to assign node text.

The solution you suggested worked fine as desired.

Thanks & Best Regard.
Girish
User avatar
Girish
 
Posts: 12
Joined: 24 January 2019, 10:40


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 3 guests