NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: johanl on August 07, 2013, 05:16:58 AM
-
Hello
Is there a way in NTWS to color specific lines in a NetwebBrowse depending on a specific condition?
I did search the forum but could not find anything for my requirement
Regards
Johan
-
Johan,
Glad you posted this as I want to do the same exact thing.
Chuck
-
HI Johan/Chuck
If you select the field that you want to colour code and then move to the conditional tab.
Insert into the Display options
e.g.
Condition: FIL:Status = 1
CSS Class: ' red-bg' (note the space before the word red)
and
Condition: FIL:Status = 2
CSS Class: ' blue-bg'
etc.
In your web folder there is a file called netweb.css where Bruce has set some standardised background and text colours which you can use or set your own in your custom.css file.
-
good answer Terry. And as a bonus, if you add the class nt-grad then the background color is a gradient.
eg
CSS Class: ' blue-bg nt-grad'
Cheers
Bruce
-
How would you define a color in css that is set by the user - i.e. a Clarion long? A have a browse in the Win32 app where the user can define the colors for each line in the browse depending on a condition. The colors are saved in program setup as a Long.
So how to turn a Long into an equivalent color in a css file?
Chuck
-
good question chuck.
Example 12, HotDates, is the thing to look at here. Open that, go to the BrowseRooms procedure.
Go to the properties for the description column, and from there to the CSS tab for that field.
Note the "extra properties" there, and how they are set.
Cheers
Bruce
-
Thanks for the answers
-
Bruce,
Tried to use HotDates example 12 as an example but the rows in the browse are only colored gray regardless of the color that I set - your example does the same thing - no colors, only gray.
Chuck
-
Chuck,
I use colored backgrounds in cells on NetTalk browses a lot, and this works for me reliably.
1. Add an entry in the \web folder in the Custom.css file:
.greenback{
color:black;
background:#A9F5A9 !important;
text-align:right;
}
.yellowback{
color:black;
background:#FFFF66 !important;
text-align:right;
}
2. In the browse, on each column that I want colored based on a variable, in the Conditional Tab for the column, enter the following conditions:
LOC:FlagField = 'G' CSS Class: 'greenback'
LOC:FlagField = 'Y' CSS Class: 'yellowback'
You could use a database field or a local variable that gets set as the records are read. Make sure you have it entered as a hotfield if needed.
That's it - works smoothly and reliably. The Custom.CSS entries ensure I have black text on the colored background.
Hope that helps,
Mike Springer
-
Mike - that's a good approach when you know the fixed colors. In Chuck's case the colors are variable - ie set by the user in the database. In that case you use the "property" approach as in the Rooms procedure in the Hotdates example.
Chuck-
>> Tried to use HotDates example 12 as an example but the rows in the browse are only colored gray regardless of the color that I set - your example does the same thing - no colors, only gray.
It's working here, but apparently it's broken in the Chrome browser - which is what you are using I suspect. In FF and IE it's ok. I'll fix that for the next build (assuming it can be fixed). Specifically it's the nt-grad part that is not working in chrome, so you can remove that part for now if you like. (It makes a big difference to the app though so I recommend it gets back on when it's fixed.)
cheers
Bruce
-
Bruce,
I found out by trial and error that the gradient part of the css was causing the problem. I was only testing in Chrome so did not see it working in other browsers. Too bad I am recommending to my users to use Chrome for the web app. Hopefully it is something you can fix for Chrome.
Also, thanks for the post in the C8 newsgroup regarding converting a Clarion LONG to a web color. I should have asked here first.
Chuck
-
Yes, I recommend Chrome as well, and I'm sure it's fixable.
also - regarding the LONG/Hex thing - the templates should take care of that for you - if they don't please let me know where you're using it and maybe it can be smarter.
(You'll occasionally see an option "color stored as LONG" - which you would obviously tick if the color is a Clarion Long value in the database.)
cheers
Bruce
-
Bruce,
Have you been able to fix the nt-grad bug yet that shows up only in Chrome?
Chuck