struts 2 jquery grid plugin change only one column header style - struts2

Is it possible to change the style of only one column heard in grid ?!
The sjg:gridColumn has a cssClass property, but setting this css will only be applied to rows under the column, not the column header.
At JQGRID - Is it possible to change the background color of HTML header text in JavaScript? I got the code as:
in your HTML page. If you want make the changes for one column only
you can use setLabel method:
$("#myGrid").jqGrid('setLabel','Price', '', {'background':'red'});
or
$("#myGrid").jqGrid('setLabel','Price', '', 'myColorClass');
But I could not make it work.
Finally, as the columns headers will have unique Id, I could use below:
document.getElementById("gridtable_sampleColumn").style.backgroundColor = "#FF0000";
Well do you think there is a better way. I was looking for some thing like this:
<sjg:gridColumn name="sampleColumn"
cssClass="makeThisSmall" />
And in my css
.makeThisSmall{
font-size : smaller;
}
Which did not work and only change the rows css not column header.
Also I find that the gridColumn has a formatoptions could this do what I am looking for ?!

There are no declarative way to set style/class of the column header for specific column (I exclude definition of the CSS rule where the id or the column name are set explicitly). So you should use setLabel to set it.
If you need to change background color then you should take in consideration that background-image have to be set to none too. Additionally you should don't forget that other CSS rules will be applied too and the rule with more specific CSS selector will win. For example the font-size in the column header will be applied because of the following rule from ui.jqgrid.css:
.ui-jqgrid .ui-jqgrid-view {
font-size: 11px
}
which have two classes in the rule. If you want to change the value for columns having makeThisSmall class then you should define CSS rule like
.ui-jqgrid .ui-jqgrid-view .makeThisSmall {
font-size: 8px
}
or
.ui-jqgrid-view .makeThisSmall {
font-size: 8px
}
In any way it should be at least so complex or more complex as the CSS rule which you want to overwrite.
In the same way the background will be applied because of CSS rule which contains two classes too
.ui-widget-content .ui-state-default {
background: ...
}
So you need define the corresponding deep (or deeper) CSS role too to be able to ovewrite it via class attribute.

Related

Set angular component default values

I am using angular material components. In mat-card-actions component I would like to set align=end as a default value, so that I do not need to add it in all my forms.
What is the best way to achieve this? I was thinking about extending the component, but I'm hoping for a simpler solution.
You can make it by simple style in your css. Look :
In your global styles or some else define this styles:
mat-card-actions {
display: flex;
justify-content: flex-end;
}
Example on stack
P.S. It is same as use align="end" but you make it by CSS not by JS

How to use filter after using hide on tr

I currently use tablesorter on a legacy project to add filtering and i'm stuck with a behaviour:
if you manually use $("#tbody>tr").hide(), then $("#tbody>tr.someClass").show(),
Filtering seems not work ( I think tablesorter lost his reference of tr... but i can't find how to told it to update his internal ref).
here an exemple of this behaviour :
https://jsfiddle.net/f2qdz3dp/
When you use a custom theme, you'll need to add this bit of css:
.filtered {
display: none;
}
You can rename the css class by modifying the filter_filteredRow option.
Also, you can set an initial search value by including a data-value attribute on the header cell:
<td class="info" ... data-value="bla">info</td>
This attribute name can also be changed using the filter_defaultAttrib option.

how to create two columns with div and CSS

I realize that this topic was discussed many many times. However, none seem to apply to me. I am generating HTML page using ASP.NET MVC construct HTML.DisplayFor() which generates <div class="display-label">Label</div> <div class="display-field">Value</div> pair for every property. I am trying to display them as a column - each line would have a label and a value. I tried various combinations, the best I came is the following:
.display-label {
font-weight: bold;
float: left;
width: 25%;
}
.display-field {
margin-left: 25%;
width: 75%;
}
Looks close to what I want; however, some fields have NULL value, in which case generated HTML is <div class="display-field"></div> In this situation next label is shown on the same line (where value would otherwise be).
I tried clear and display in various combinations - but none of them shows a label, a value and an empty block if the value is missing (for example, clear shifts all values up).
I am sure I am not the first one trying to solve this problem. But I couldn't find anything relevant; and my CSS skills are clearly insufficient. And yes, I know that I can write a custom DisplayFor template; but I was hoping that it wouldn't be necessary!
<div class="display-label">Label</div> <div class="display-field"></div>
<div style="clear:both"></div>
<div class="display-label">Label</div> <div class="display-field">Value</div>
Worked for me.
I think I got something that makes it work:
.display-field::after {
content: ".";
visibility: hidden;
}
Intuitively, I don't like it; so if somebody has a better solution, I'd love to use that one. But it works, and I don't have to mess with the template for a huge class

How to style internal elements of a Dart Web Component?

I am playing with the popover component in the Dart "bee" Web Components package (bee)
However, I can't see a way of changing the default styling for internal elements of the component. I want to change the style of the <div class="x-popover-dialog"> so that it has rounded corners. However, if I add the following to my app's css file, it just gets removed by the time it gets to the "out" folder.
.x-popover-dialog {
border-radius: 6px;
}
Is this possible, or is the only way to actually modify the Web Component itself (or perhaps extend it)?
Thanks.
Okay, there are a number of factors here. First, is you cannot redefine a class defined within a component. You can currently apply your own styling to a component if that element does not specify its own styles. For instance, you can change the font-size on on 'p' elements within a component. Or say div#someid { color: red; } but you cannot redefine a class, or add definitions to a class.
The very fact that you can modify the styles at all, unless explicitly allowed, is a bug in the web_ui. Currently tracked as: Issue 374: Support apply-author-styles.
Ideally, when full support is implemented, you will not be able to apply your own styles to a web component unless explicitly permitted by the web-component itself. For more information on apply-author-styles and the related reset-style-inheritance see the great Shadow DOM 201 tutorial.

Rails simple_form gives dots under stars for required fields, better way to remove them?

In many of my projects I use simple_form and love it.
However one really strange quirk that I find is that I get 3 small dots underneath the * it supplies for required fields.
I have to get around it with:
= f.input :name, :label => '*', :required => false # Display purpose only (it is required)
Which is messy because the field is required, so this code looks ugly.
Is there a better fix for what seems like a common problem?
I think it's from CSS, if you are useing blueprint, "abbr and accronym" tags have a border-bottom: 1px dotted black style.
Try add to your css file the next line :
abbr, accronym{ border-bottom: 0px; } /*try adding !important after 0px if doesn't work*/
Wish helps :)
It seems like CSS stuff. See what are the properties for abbr tags on your CSS.
Simple form adds an abbr with a border-bottom.
You can remove the border-bottom just with css, but you also need to override the text underline property (which I think comes from default navigator styles)
So, this small css block should work :
form abbr[title] {
border-bottom: none !important;
text-decoration: none !important;
}
There's another solution that I found, in case anyone else comes across this question in the future. I responded to a similar issue that was closed on simple_form with this:
I had this issue too, and it would be pretty easy for the simple_form
maintainers to change, so it might be worth looking into. At the very
least, I'd like to help if someone else runs into the problem using
the gem combination I'm using. On a new rails 5.2.3 app, with
bootstrap 4.3.1 and simple form 4.1.0, I had the same issue with an
ellipses under the asterisk.
I found a way to solve it, since it actually only happens when using
the tag. In locales/simple_form.en.yml, if you remove mark: '', and
change html: '' to html: '*', this removes the ".." that appears under
the asterisk. This occurs because there's an included style with
bootstrap that adds an underlined dotted border to any abbreviation
tags, which allow the user to select that text in order to view the
rest of the word.

Resources