XForms: CSS for a label - css

I need just one word in a label to be red. When I have a static text, everything works fine, as you can see here:
But I want to use in the label the value of another control. I am trying to do this with:
<xf:label value="concat('Is your name is ', xxf:bind('control-1-bind'), ' ?')"/>
But how can I make the imported value (control-1) red?

Try the following:
<xf:label mediatype="text/html">
Is your name
<xh:span class="labas"><xf:output value="xxf:bind('control-1-bind')"/></xh:span>?
</xf:label>

Related

Django/BooleanField: how to add space between case and label?

I have a django project
I have an models with a booleanField -> checkbox in the form
But I don't know why the checkbox is sticked to the label.
I try to select the html element to add specific css but the 2 elements move together...
current result: [ ]I have read... (the 2 elements are sticked)
expected result: [ ]......I have read...
models.py
class Aveugle(models.Model):
unb_ide = models.AutoField(primary_key=True)
unb_val = models.BooleanField("I have read ITBM procedure and want to unblind treatment", null=True, blank=True)
forms.py
unb_val = forms.BooleanField(label = _("I have read ITBM procedure and want to unblind treatment"))
Try:
This is a temporary solution, but it's just a patch, you need to handle css and html better to make it more solid.

how to change color of background, row , row selection and header in angular 4 with bootstrap 4 data-table

I have implemented bootstrap 4 data table 4 in angular 4 but not able to change or modify row color. row selection color and header color as well.
I am using the data table 4 example : https://github.com/afermon/angular-4-data-table-bootstrap-4
and in this examples demo go through the demo 1 of link: https://afermon.github.io/angular-4-data-table-bootstrap-4-demo/
Considering the below code snippet present in data-table-component-demo1.ts got by the Git project you downloaded:
<data-table id="persons-grid"
[header] = "false"
[multiSelect] = "false"
[substituteRows]="false"
[indexColumn]="false"
[items]="items"
[itemCount]="itemCount"
(reload)="reloadItems($event)"
[pagination]="false"
(rowClick)="rowClick($event)"
[rowColors] = "callBackForChangineRowColors"
>
<data-table-column
[property]="'name'"
[header]="'Name'"
[sortable]="true"
[styleClass]="someExplicitClass"
In this, we can assign the value 'someExplicitClass' to [styleClass] as shown above and define the class someExplicitClass in our data-table-component-demo1.css file as below:
:host /deep/ .someExplicitClass{
background-color:red;
}
However, this is applied to the whole of the DataColumn and not controllable on a granular level.
We can indirectly apply only background-color using the rowEvent variable available within the rowClick(rowEvent) function of 'data-table-component-demo1.ts'
On click of the row, I will set the selected property of the row to true and thereby will trigger the onRowSelectChanged function of table.component.ts file
Now, once I set [rowColors] value to "callBackForChangineRowColors" as shown above and make the below changes in my data-table-component-demo1.component.ts file:
rowClick(rowEvent) {
console.log('Clicked: ' + rowEvent.row.item.name);
rowEvent.row.selected = true;
}
callBackForChangineRowColors(a,b,c)
{
if(b.selected)
return 'blue';
}
This way, I will be able to apply the color of blue explicitly for the selected Row.
*I could'nt unfortunately find any solution to apply any other styles on a granular level using a readily available input parameter like [styleClass] for it wasnt exposed as an #Input within our column.component.ts. If anyone has an idea, please do help me know it.

How to place underline under a paragraph in itextsharp

I am using iTextSharp in my current project. I have created a table with some underlined data but my requirement is shown in this image:
http://postimg.org/image/402ap3acf/
How can I build this type of table.
I need the below structure.
A/C Some text TAT Some text
----------------- -----------------
The doted lines are underline.
The underline is controlled via the Font object and if you only want to set part of a Paragraph to be underlined you'll want to use a Chunk.
Here's a quick helper method for generating a font with different styles. You can change the actual font to whatever font you want to use.
Private Shared Function CreateFont(size As Integer, Optional style As Integer = iTextSharp.text.Font.NORMAL) As iTextSharp.text.Font
Return New iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, size, style)
End Function
The style parameter takes integers from this list that you OR together:
iTextSharp.text.Font.NORMAL
iTextSharp.text.Font.BOLD
iTextSharp.text.Font.ITALIC
iTextSharp.text.Font.UNDERLINE
iTextSharp.text.Font.STRIKETHRU
So normal underlined text would be:
iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE
You can use the above like this:
Dim P As New Paragraph()
P.Add(New Chunk("A/C ", CreateFont(12, iTextSharp.text.Font.NORMAL)))
P.Add(New Chunk("Some text", CreateFont(12, iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE)))
EDIT
From iTextSharp's perspective, "underline" means "a line drawn underneath text". If there's no text there won't be an underline. A space, however, counts as text so you can just add extra spaces if you want like to continue the underline:
Dim P As New Paragraph()
P.Add(New Chunk("A/C ", CreateFont(12, iTextSharp.text.Font.NORMAL)))
P.Add(New Chunk("Some text ", CreateFont(12, iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE)))

div with overflow on the left and left aligned showing the end of the text

trying to set up css doing the following:
Imagine we have two equal parallel divs with text in it:
<div class="xy">Example</div>
<div class="xy">This.is.a.example.of.a.long.Text</div>
The divs are wider than "Example" but less wide than "This.is.a.example.of.a.long.Text".
Now I want to see these texts left-aligned, so that the odd space is behind "Example" on the ride side.
But i also want to use
text-overflow:ellipsis
with the longer text in a way that I will see the end of the text.
So it should look like:
"Example "
"...ample.of.a.long.Text"
How do I do this?
I was just curious to your question and give it a try in java script as follows,
Demo
var maxChar = 20,
dots = '. . . ',
toTrim = $('.toTrim'),
toTrimLength = toTrim.text().length,
getChar = toTrimLength - maxChar;
if(toTrimLength > maxChar){
var newString = dots + toTrim.text().slice(getChar)
toTrim.text(newString);
}
I guess you still need to modify this to suite your requirement.
Also add the same string in title attr to see full text when hovering and if you want to do it even better. change text-overflow on :hover
this article will help you http://html5hub.com/ellipse-my-text/#i.6k1nyg11zqdiar

Flex 3 Multicolored Text in DataGrid Cell

I am having an issue with styling individual cells in a DataGrid. I want to go through the text in a DataGrid cell and only color a specific portion of the text.
When a User uses a search filter, we want to color and bold the text in the cell that matches the search phrase. For example, the User filters a column of job titles with the search phrase "Adjust" and one of the cell values is "Claim Adjusters", we want "Claim " and "ers" at the end to be black font color and the "Adjust" to be another color (let's say red).
I noticed that if the String passed to the DataGrid was of the form:
value.substring(0,start) + "(b)" + value.substring(start,finish) + "(/b)" + value.substring(finish);
With "<>" rather than "()", the text between the bold tags gets displayed with a bold font, but it does not work with (font color=\"red\") ... (/font).
Any suggestions on how I can get the search text to color here as well as bold?
Only hexadecimal color (#FFFFFF) values are supported.
A simple alternative with lots of flexibility is to make your itemRendrer support html formatting:
public class HtmlItemRenderer extends DataGridItemRenderer {
override public function validateProperties():void {
super.validateProperties();
if (text.indexOf('<') > -1) {
htmlText = text;
}
}
}
The conditional doesn't need to be very strict, it will still save some cycles for most cells that contain no markup.

Resources