I have started to use the PrimeFaces p:editor for text input and for the most part I am fairly pleased with how it works. However the documentation notes that the CKEditor on which it is based does not plug into the ThemeRoller framework so the components dimensions do not adjust automatically.
So for example:
<h:panelGrid columns="2">
(stuff)
<h:outputLabel value="Content:" />
<p:editor id="editDoc" widgetVar="editorDoc"
value="#{editDocument.text}"
style="width: 700px"
/>
(more stuff)
</h:panelGrid>
I would like the p:editor to expand to the width of the table that h:panelGrid renders. Yet nothing I have tried works. Any suggestions?
UPDATE:
I should note that the p:editor tag pays no attention to the style attribute. Instead it has a width attribute and a height attribute and they don't work the same way the CSS parameters would work. For example width="100%" is an error.
The actual width of the p:editor depends on the size of its inner <div>. You can simply overwrite that default value:
<style type="text/css">
#editDoc > div {
width: 99.5% !important;
}
</style>
also remove the style="width: 700px" of the p:editor and attach it to the h:panelGrid instead.
A more general solution which applies to all p:editor components is to overwrite the default width attribute of the .ui-editor class:
<style type="text/css">
.ui-editor {
width: 99.5% !important;
}
</style>
For Primefaces 4, we have to set the width of the inner iframe:
<style type="text/css">
.ui-editor iframe {
width:100% !important;
}
</style>
Related
I have a couple long drop downs, so I set a height so I would get scroll bars. I am using the jquery selectmenu dropdowns. All the dropdowns are ignoring the height, even though I can see it in the 'developer' window (f12) and is not overwritten. I have tried to apply it a couple ways:
CSS:
.ddl
{
width: 310px;
height: 200px;
}
or
.ddl
{
width: 310px;
max-height: 200px;
}
or
.ddl
{
width: 310px;
height: 200px;
overflow-y: auto;
overflow-x: hidden;
}
I am sure I have all the scripts I need and in the correct order, because all the other jquery ui stuff is working find, even on the dropdowns. It is just the height is being ignored.
All the dropdowns have the class of "ddl", and this is in the included footer for all pages:
$(".ddl").selectmenu();
Here is the list (in order) of the included scripts:
<link href="/Content/site.css" rel="stylesheet"/>
<link href="/Content/custom.css" rel="stylesheet"/>
<link href="/Content/h-menu.css" rel="stylesheet"/>
<link href="/Content/themes/skps/jquery-ui.css" rel="stylesheet"/>
<link href="/Content/themes/skps/jquery-ui.structure.css" rel="stylesheet"/>
<link href="/Content/themes/skps/jquery-ui.theme.css" rel="stylesheet"/>
<link href="/Content/themes/grid/ui.jqgrid.css" rel="stylesheet"/>
<script src="/Scripts/jquery-1.11.1.js"></script>
<script src="/Scripts/jquery-ui-1.11.1.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/jquery.jqGrid.src.js"></script>
<script src="/Scripts/grid.locale-en.js"></script>
<script src="/Scripts/modernizr-2.6.2.js"></script>
If it matters, this is an ASP MVC4 app. Here is the JSFiddle. This is my first fiddle, so not sure if I did it right. http://jsfiddle.net/battlfrog/jmhwxgom/
I am attempting to get it to work like this: http://api.jqueryui.com/selectmenu/#method-menuWidget
I know this is a bit old but I've found out how to do this using CSS. You can either edit the jquery-ui.structure.css file directly or apply this in the .css file for your page. The following is used when editing the jquery-ui.structure.css file. (There is a lot more you can do with this, but this is the basic change required to get the effect you want.)
.ui-selectmenu-menu .ui-menu {
overflow-y: auto;
overflow-x: hidden;
padding-bottom: 1px;
padding-right: 10px;
width: auto !important;
max-height: 8.8em;}
Note that the overflow property has been deleted and overflow-y: auto has
been added instead.
Width must be added with !important.
You can use height instead of max-height and then set it to whatever
height you wish, but doing so will cause all select menus to
have the same height, even if it has one or two options (and thus
creating empty space at the bottom of the option list. Using max-height will ensure that the scrollbar is only used when the list length exceeds the height instead.
The above max-height will give you 5 options shown in your list when your font-size is set to 0.9em. I leave it up to you to do the appropriate calculations to get your preferred number of options shown.
The padding-right property is required for browsers other than MSIE. While I've found that MSIE adjusts the width of the list properly to accommodate the text for the option, Firefox, for example, does not. Adding the padding pushes the right of the edge away from the text. Unfortunately it has the unpleasant effect of doing it with MSIE as well, causing a large empty area to the right of the option text. A bit of MSIE CSS hacking here would clear up the problem, but I just want to address the core issue.
If you wish this to be global edit the jquery-ui.structure.css file. I find this a better solution because I can then fine tune the height per page by applying a different max-height property for each affected page (I convert the css file into Sass myself, makes things a lot easier).
I have:
<x-dialog><p>Whatever</p></x-dialog>
The <p>Whatever</p> stuff is of course passed into the x-dialog element's <content></content> tags:
<polymer-element name="x-dialog">
<template>
<link rel="stylesheet" href="dialog.css">
<core-overlay id="overlay" layered backdrop opened="{{opened}}" autoCloseDisabled="{{autoCloseDisabled}}" transition="core-transition-center">
<content></content>
</core-overlay>
</template>
<script type="application/dart" src="dialog.dart"></script>
</polymer-element>
How and where do I style my <p>, i.e. the content passed to my element? Note that this content is itself in a child element, core-overlay in this case, but I don't think that made a difference (it was the same result when I moved it out of core-overlay).
The style guide at http://www.polymer-project.org/articles/styling-elements.html didn't get me to a solution (I'm assuming Dart is up to par w/ this JS guide).
If you want to add the style rules to your x-dialog element the related section in the styling guide are Styling distributed nodes
add this to your dialog.css
content::content p {
background-color: blue;
}
Otherwise you can style it like any child element of normal DOM elements
x-dialog p {
background-color: blue;
}
We are upgrading from jsf 1.2 to jsf 2.
We are using apache myfaces 2.1 and rich faces 4.3.
The issue is i am not able to get borders around <rich:dataGrid> component.
I have seen posts describing how to remove the borders but no one specifies how to get borders.
It seems that borders are by default rendered earlier (they were coming when rich faces 3 is used ) but after upgrading to rich faces 4 , ther are not rendered
by default.
Following is the xhtml snippet.
<rich:dataGrid value="#{bean.getListValues}" var="value" columns="1" rowKeyVar="index" id="qsns"
style="border-bottom-width:10px;">
<h:panelGrid id="qsn#{index+1}" border="10" columns="2">
<h:outputText value="qsn #{index+1}"/>
<h:selectOneMenu value="#{value.qsn}">
<f:selectItems value="#{bean.qsnPool}" />
</h:selectOneMenu>
<h:outputText value="Answer"/>
<h:inputText value="#{value.answer}"/>
</h:panelGrid>
</rich:dataGrid>
I also tried setting borders explicitely for panelGrid (border="10") in above snippet.
and to rich:dataGrid (border-bottom-width:10px), but it is not working as specified in url according to url : http://docs.jboss.org/richfaces/latest_4_2_X/Component_Reference/en-US/html/chap-Component_Reference-Tables_and_grids.html#sect-Component_Reference-Tables_and_grids-richlist
Can anyone please help ?
The border-bottom-width:10px; isn't working because the border-bottom-style is none.
The borders around <rich:datagrid> aren't defined on one element. The left and top borders are defined on the datagrid, class rf-dg. The bottom and right are defined on the grid cells, class rf-dg-c. You'll have to overwrite the classes if you want to change all the borders.
I am able to get the desired behavoiur by following changes
.tableClass1 .rf-dg-c{
border: 1px solid #000;
}
table.tableClass1.rf-dg{
border-collapse:collapse;
}
<rich:dataGrid value="#{bean.getListValues}" var="value" columns="1" rowKeyVar="index" id="qsns"
styleClass="tableClass1">
<h:panelGrid id="qsn#{index+1}" border="10" columns="2">
<h:outputText value="qsn #{index+1}"/>
<h:selectOneMenu value="#{value.qsn}">
<f:selectItems value="#{bean.qsnPool}" />
</h:selectOneMenu>
<h:outputText value="Answer"/>
<h:inputText value="#{value.answer}"/>
</h:panelGrid>
</rich:dataGrid>
With above style classes and xhtml code , borders are perfectly rendered.
First style sheet renders borders for grid cells and second style sheet collapses
the space between adjacent cell borders (since cellspacing attribute doesn't work for rich:dataGrid)
The above selectors apply only to local <rich:dataGrid> , that means not affecting globally for all <rich:dataTables>
The border attribute is not doing much, try using CSS styling:
<h:panelGrid style="border: 1px solid #000;"> ...
Or use CSS via classes:
<h:panelGrid styleClass="myClass"> ...
In your CSS:
.myClass {
border: 1px solid #000;
}
I have a page on a project I'm creating for class where I wanted to align an image in the left side, with the text to the right aligned in the middle of the image. Instead of using html elements, I decided to try an internal CSS div elements within my external CSS. My problem is that I can't get them to align correctly vertically. I have the horizontal alignment, but the text either appears one line above or one line below the image. I tried the techniques included in this posting, but they didn't fix my problem. Align <div> elements side by side
Here is my internal CSS.
<style type="text/css">
/* left div holding the image */
#left {
width:170px;
align:left; }
/* right div to hold the text */
#right {
margin-left: 200px;
text-align:left; }
</style>
Here's the HTML
<div id="content">
<br/>
<br/>
<br/>
<blockquote>
<div id="right">Check back soon. Click here to receive an email when the site becomes available.</div><div id="left"><img src="images/construction-clipart.jpg" border="1" alt="Page under construction" /></div>
</blockquote>
</div>
Can you help me figure out how to make these align? To view how it is rendering, please visit my student project site at http://www.student.nvcc.edu/home/ligomes/TwoWiredChicks/Browse.html.
Thanks!
Finally, I hope this helps now. All you have for the right css is:
#right {
position: absolute;
margin-left: 200px
}
I have an issue with displaying the label value for the <h:commandButton>. For example, please see the below code
<td align="left" style="float: left;">
<h:commandButton value ="Reset Demand To Default" styleClass="refresh-button-style" />
</td>
I have created the styleclass for this button and the code for the styleclass is specified below.
.refresh-button-style
{
word-wrap: break-word !important;
background-color:#2996EF;
height:40px;
width:100px;
font-size:13px;
text-align: center;
font-family: Arial;
}
When I try to run the xhtml file and disable the label value, The label value seems to get displayed horizontally. It does do the wordwrap and hence displays only part of the button label. Can you please let me know how to achieve the wordwrap for the button and display the entire label value within the command Button.
Try the following css attribute:
white-space:normal;
This should wrap the text as expected (source).