Oracle Apex control CSS layout for Standard Report Columns - css

I have an ApEx report where i need to customize the css width of columns differently. For this I'm using the CSS Class attribute in the report:
The CSS Class assigned is as shown: WideColumn
And in the HTML header for the application page :
<style type="text/css">
.WideColumn {
min-width:100px;
}
</style>
This is not taking effect. In fact whatever css attributes are assigned, do not take effect.
I do not want to use the CSS Style section to specify 'display:block;min-width:100px;' due to certain limitations.
What is it that I'm missing out in the column attributes?
I've tried CSS Class within quotes too: 'WideColumn' Please suggest.

The custom row template can not deal with the CSS class definition. The CSS under "Column formatting" normally generates a span element with a class set to it, not the td element. Setting the "Element CSS class" for the element itself will not always help aswell. If your column type is a "Standard Report Column" then no extra html is created.
You also have no option of providing a substitution string in the template itself to create some output.
You could
add an extra column in the source query which will contain a class.
Use the column header in the row template to add this custom class.
alternatively use the class column in the html expression of the
column you want to change. Similar to standard output, you could use
<span class="#CLASSCOL#">#MYCOL#</span> to generate that html.
target the generated column with CSS. For instance, if your template
generates th elements and a headers attribute on td elements
(like in standard reports), you can target those columns much more
easily than fiddling with classes or html expressions. You might need
to adapt the template but it should be generally beneficial.

You can do this with some Javascript using the jQuery library built into APEX.
(WARNING: My Javascript isn't the world's most elegant!)
This worked for me:
1) In the "Function and Global Variable Declaration" attribute of the page create this function:
function setColWidths(colId) {
var maxWidth = 0;
$('th#'+colId).each (function (index) {
w = $(this).width();
maxWidth = Math.max(maxWidth,w);
});
$('th#'+colId).each (function (index) {
$(this).width(maxWidth);
});
}
2) In the "Execute when Page Loads" attribute of the page call the function for each column:
setColWidths('COL01');
setColWidths('COL02');
setColWidths('COL03');

Related

Can I Add Custom Formatting Markup to MediaWiki?

Is it possible to add custom formatting markup to MediaWiki?
Say, for example, I have a div style I use quite often and I'd like to make markup to apply it more quickly than using <div id="frequentlyusedstyle">Title</div> -- like surrounding the text with ##Title## instead of typing out the div id. Is that possible?
(I realize that there is already heading markup; that's just an example. Thank you in advance!)
Just create a new page named "Template:name", where 'name' is whatever you want to name it, with the following text (as per your example):
< div id="frequentlyusedstyle">{{{1|}}}< /div>
(minus the extra spaces, since I don't know how to keep html from
parsing here.)
You would then use it by adding {{template name|Title}} to an article, and it will invoke the style.
You will need to have a style defined in MediaWiki:Common.css or similar, in order to style that div, such as:
#frequentlyusedstyle {
color: red;
}
Hope that helps.

Dojo - Giving multiple className in domConstruct.create()

I am new to DOJO toolkit and still learning. I have a situation in which i want to give multiple css classes to the element created by dojo's domConstruct.create() method.
I created table element and four columns - 'td' elements with domConstruct.create() method. each column is styled differently.
I created my class -'errors-alignment' and have existing class 'error'.
If i add inline styles for more styling, it works.
domConstruct.create('td' , { className:'error',style:{....}},...)
className:'error-alignment error' //two classnames do not work either
But i can not have inline styles and can not modify existing class.
Is there anything existing in dojo or css to help me providing multiple css to an element.
You can do:
var newNode = domConstruct.create('td' , { 'class':'error' }, parentNode);
You can also use dojo/dom-class and dojo/dom-style to modify the class and style of an already existing node.
http://dojotoolkit.org/reference-guide/1.9/dojo/dom-class.html
http://dojotoolkit.org/reference-guide/1.9/dojo/dom-style.html

TYPO3: how to add an element to the RTE, which allows the user to use a defined CSS class

I want that the user should be able to select an textstyle in RTE like Detail, Important, Name of person and so on. So I would like to define a CSS and this option should be shown in RTE. The CSS style should be a span and only setting a color.
Currently I have the following code:
RTE.classes{
highlight{
name = test
value = color:#0A8AD2;
}
}
RTE.default{
ignoreMainStyleOverride = 1
useCSS = 1
contentCSS = fileadmin/templates/css/rte_formats.css
classesCharacter := addToList(highlight)
classesParagraph := addToList(highlight)
proc.allowedClasses := addToList(highlight)
}
The content of the CSS file is
span.highlight, p.highlight {
color:#0A8AD2;
}
But the new added style isn't shown in the drop down (textstyle). I also enabled "additonal inline elements" in th rtehtmlarea configuration. I also tried to set showTagFreeClasses and so on without success. Then I read about caching problems. I deleted the RTE cache as well as the browser cache. Still no result. What can be wrong?
You are basically on the right track!
I have experienced quite some problems using inlineStyle. One of them being that you have to explicitly undefine the contentCSS to make the inlines work (only setting ignoreMainStyleOverride = 0 is not enought!):
RTE.default.contentCSS >
I personally prefer a dedicated external CSS file. The important thing to know is that the TYPO3 RTE really parses this CSS file and only offers those classes that are actually found in there!
So you have to use the contentCSS parameter to define a CSS and this CSS must really contain the classes that you want to make available to the user. Here is how you must define it:
# TS-Config
RTE.default.ignoreMainStyleOverride = 1
RTE.default.contentCSS = fileadmin/templates/css/rte_formats.css
The CSS file must exist at the give URL and it must contain a definition for the CSS class that you want to provide (as said the CSS file is really parsed and missing classes will not show up in the dropdown selector):
/* content of rte_formats.css */
/* span. needed for RTE.default.classesCharacter */
/* p. needed for RTE.default.classesParagraph */
span.highlight, p.highlight{ color:#0A8AD2; }
And one more hint:
I recommend not to overwrite the allowedClasses with your own class name(s), but append to them:
RTE.default.proc.allowedClasses := addToList( highlight, myOtherClass, myThirdClass )
Good luck!

webGrid.Column doesn't allow change in column width

I am using a webGrid and would like to be able to change the width of the columns. I am using the following code for the style but it seems to have no affect.
webGrid.Column(columnName: "TRP_Comments", header: "Comments",style: "width:500px;"),
Is this not what style is suppose to do?
Thanks
Bruce
The style property doesn't set the style attribute but the class attribute. Yeah, I know, WTF. The designers of the WebGrid component must have been mentally disturbed at the moment they choose the name of this optional argument. The whole dynamic and optional arguments stuff they put into this component makes me hate it like hell and never use it in any application.
Anyway, you could define a custom CSS class in your separate CSS file:
.comments {
width: 500px;
}
and then assign this class to the corresponding <td> elements:
webGrid.Column(columnName: "TRP_Comments", header: "Comments", style: "comments")

Style row banding and selection in tr:table using CSS

I've got a tr:table that I need to style using CSS. All the normal style functions of a table are working, but row banding and row selection aren't coming up. When I view the rendered source, I'm not seeing a difference in the rows for an id or class to grab on to, and the official documentation doesn't have any attributes for declaring a style class for either. Is this possible and if so what do I need to do to get my CSS to grab onto it?
<tr:table id="myTable" value="#{tableValues}" rowBandingInterval="1">
<tr:column>
##Stuff##
</tr:column>
<tr:column>
##Stuff##
</tr:column>
<tr:column>
##Stuff##
</tr:column>
</tr:table>
Edit
Let me try to clairfy what's happening.
First, using the declaration above tells jsf to generate a table, and the attribute rowBandingInterval tells it to give each row alternating colors (If it was set to 2, then it would do 2 rows one color, 2 rows another, 2 rows the original, etc.)
Once the page gets rendered into standard html, trinidad (and jsf) apply their own classes and IDs to the html. My normal procedure is to look at the rendered html, find the class that it is appling and add CSS rules for it. However in this case, no additional styles are added (nothing in the rendered html denotes one row to be different from another).
So the question is, how do I tell trinidad to either give alternating rows and the user selected row different classes/IDs for me to grab on to with CSS?
Edit 2
Just to keep anybody paying attention posted, there are no changes to the actual td elements either
Edit 3
After having switched all the attributes around and then stripping all the code down to it's bare bones, I found the row banding attribute. Trinidad classes are rather convluted, and unless you reformat the code and pull out all the noise you won't see it. Trinidad adds the class .af_column_cell-text-band to the banded rows, where as the normal rows have just .af_column_cell-text. So that's half the problem solved. I still need to know the selector for a user selected row, for which I'll happily give all the marbles to anybody that can give me an answer to just that.
This is not directly answering your question, but why not use the CSS3 pseudo-class nth-child to achieve this effect ? For instance :
tr:nth-child(2n)
{
background-color:red;
}
There is a nice and simple jquery code to do the row highlighting located here.
The jQuery is as follows
<script type="text/javascript">
$(document).ready(function(){
$(".stripeMe tr")
.mouseover(function() { $(this).addClass("over");})
.mouseout(function() { $(this).removeClass("over");
});
$(".stripeMe tr:even").addClass("alt");
});
</script>
Then a bit of css
tr.alt td { background: #ecf6fc; }
tr.over td { background: #bcd4ec; }
btw I took all that code from the following site where you can also view the demo.
I made something wrong during the registration process, so this is a new answer instead of a comment.
To deal with the trinidad-skinning topic you need to do the following:
In your web.xml you need to set this parameter to true while developping:
<context-param>
<param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
<param-value>true</param-value></context-param>
Get firebug for your firefox. With that add-on you can determine which trinidad-selector is used on a component.
There is no selector for a user selected row. I did it this way:
Give your object something like a "highlight property", which you change if it is the selected one.
<tr:column sortProperty="nr" sortable="true" defaultSortOrder="ascending" headerText="Nr" inlineStyle="#{object.tablerowhighlight}text-align:right;"><tr:outputText value="#{object.nr}"/></tr:column>
Do that for all columns of your table and you are done.
put these selectors in your trinidadskin.css-file(smSkin.css in my case):
.AFTableCellDataBackgroundColor:alias
{
background-color: #F5F5DC;
}
.AFTableCellDataBandedBackgroundColor:alias
{
background-color: #FFFFFF;
}
Configuration of trinidad-skins.xml
<skin>
<id>
sm.desktop
</id>
<family>
sm
</family>
<render-kit-id>
org.apache.myfaces.trinidad.desktop
</render-kit-id>
<style-sheet-name>
skins/sm/smSkin.css
</style-sheet-name>
</skin>
I will refer you to the trinidad documentation.
http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_table.html
In their example they declare the banding as row banding="row" I would assume the reason you do not get anything is that you have not declared if it is row or column banding.

Resources