I have a list of items (16 in number) for which I need to provide Check boxes.
I've used af:selectManyCheckbox to render them. The challenge is to render these 16 items in 3 columns. Tried by placing the af:selectManyCheckbox in h:panelGrid with "columns=3" but it didn't work. I'm just able to get the list in one single column.
<h:panelGrid cellpadding="0" cellspacing="0" columns="2"
id="pg2" width="100%">
<af:selectManyCheckbox id="smc1" label="Languages">
<af:forEach items="#{pageFlowScope.listingCreateBean.languageList}"
var="language">
<f:selectItem itemValue="#{language.value}"
itemLabel="#{language.label}" id="si1"/>
</af:forEach>
</af:selectManyCheckbox>
</h:panelGrid>
Help is appreciated.
Try using the <af:panelFormLayout> component and set the columns to 3 and rows to 6.
Throw away af:selectManyCheckbox.
Only one sure way to achive your goal is to use af:iterator or af:forEach with af:selectBooleanCheckbox and any layout components combination to get desired layout.
And avoid using non-adf components (like h:panelGrid), it can cause a lot of trouble with pprs and so on.
Try this
<style type="text/css">
.checkbox-grid {
width: 100%;
}
.checkbox-grid .x2f{
width: 100%;
}
.checkbox-grid div {
display: block;
float: left;
/* 25% 4columns, 33% 3columns, 50% 2columns */
width: 25%;
}
</style>
<af:selectManyCheckbox value="#{listaFormatos}" styleClass="checkbox-grid">
<af:forEach var="item" items="#{posiblesListaFormatos}" >
<f:selectItem itemLabel="#{item.value}" itemValue="#{item.value}" id="si2"/>
</af:forEach>
</af:selectManyCheckbox>
Related
I have a list items as shown below
<ul>
<li>One<li>
<li>One-One<li>
<li>Two</li>
<li>Two-Two</li>
</ul>
The output can be dynamic once showing two columns and once showing one column
like this
Two Column Scenario
One | One-One
Two | Two-Two
One Column Scenario
One
Two
Please help me how do I go about increasing the width and decreasing the width as per the scenario.I am using angular JS with html5 and css3.
Thanks for the help in advance.
Solution using display:flex and #media queries. Check below example by resizing the output window.
ul {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
li {
width: 50%;
}
#media (max-width: 40em) {
li {
width: 100%;
}
li:nth-child(even) {
display: none;
}
}
<ul>
<li>One</li>
<li>One-One</li>
<li>Two</li>
<li>Two-Two</li>
</ul>
I am trying to make simple demo of grid view .In which I have header of title (having gray background) actually I need to reduce the height of title or headers of table which have gray background .can we add alternate color of rows ? please see the given image .It header or tittle is too small as compared to my plunker .Secondly there is alternate color in row .can we add that in my plunker .
http://plnkr.co/edit/7bSnk0fU0NBOF1GIwHSK?p=preview
.search.list-inset, .search.list-inset .item:first-child {
border-radius: 50px;
}
.search .item-input .icon {
font-size: 200%;
}
.gray-20 {
background-color: #eee;
}
#media (min-width: 600px) {
.search {
width: 50%;
margin-left:auto;
margin-right: auto;
}
}
.mrginrightleft{
margin-left:5%;
margin-right:15%;
}
.brd{
border: 1px solid grey;
}
here is my code![enter image description here][1]
Updated Plunker
How to style striped rows
There are two ways to do this. One is pure CSS using the :nth-child(even) or (odd) pseudo classes. You can add a class to your row and just use style it how you want, such as:
my-class:nth-child(even) .col {
background-color: blue;
}
But I did it differently to teach you something about ng-repeat. Yes, it's for a loop, but it has a bunch of special properties that it exposes for you. Two in particular are $odd and $even. As you might expect, $odd returns true if it is an odd iteration and $even is true when the index is an even number.
So, you can use these with ng-class as part of your expression. Here, I'm adding a class of odd-row:
<div class="row" ng-repeat="column in displayData | orderBy: sortval:reverse | filter: query" ng-class="{'odd-row':$odd}">
Then to make the styles, I added the following rule. I applied the background-color to the .col children so that the background would be contained within the borders that are applied on the .col elements.
.odd-row .col {
background-color: #eee;
}
EDIT:
Actually, you are correct, ng-style would be a third-way, but it doesn't apply a class, it applies inline styles. Therefore, you need to pass it an object with you styles, so for example (simplified):
ng-style="{'color': 'red'}"
All ,
I am using ng-table for the Grid. I am using following code snippet to set the column .
<td data-title="'Access ID'" sortable="'accessID'" style="width:120px" class="text-center">{{people.accessID}}</td>
But I am not able to center align the Column Header but column data.
Here is the source code snippet for Access ID Header.
<th ng-repeat="column in $columns" ng-class="{ 'sortable': parse(column.sortable), 'sort-asc': params.sorting()[parse(column.sortable)]=='asc', 'sort-desc': params.sorting()[parse(column.sortable)]=='desc' }" ng-click="sortBy(column, $event)" ng-show="column.show(this)" ng-init="template=column.headerTemplateURL(this)" class="header sortable"> <!-- ngIf: !template --><div ng-if="!template" ng-show="!template" ng-bind="parse(column.title)" class="ng-binding ng-scope">Access ID</div><!-- end ngIf: !template --> <!-- ngIf: template --> </th>
Question is , How to center align the Header for a particular column in ng-table?
The answer submitted by #OpenUserX03 is almost perfect, except you have to wrap the class name in single quotes, like so:
<td data-title="'Access ID'" sortable="'accessID'" style="width:120px" class="text-center" header-class="'text-center'">{{people.accessID}}</td>
You can use the header-class attribute to set the class for - you guessed it - the header.
<td data-title="'Access ID'" sortable="'accessID'" style="width:120px" class="text-center" header-class="text-center">{{people.accessID}}</td>
i used to have the same issue how to align left my ng-table headers.
on the documentation of ng-table it does not say anything nor at the examples.
you have two ways to do this the fast and the more 'professional'
fast way:
open files ng-table/dist/ng-table.css and ng-table.min.css, according on which css file you use.
on the first line it manages the header,
.ng-table th {
text-align: center;/*just change that parameter to left/right*/
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
'professional' way: create a custom style and add it to your website css file ,like this :
.table thead th {
text-align: left;/*change that parameter to left/right*/
}
Hope helps, good luck.
To anyone who still has this issue, also OP, since he has not yet accepted an answer, this is how I do it. in your css (any .css)
table[ng-table] th {
text-align: left;
border-top: none;
}
Fix for ngTable
For those seeing this a year later. None of the above solutions worked for me. I added this to a custom css file:
.ng-table th {
text-align: center !important;
}
Which centered the content in the header (see images)
From this:
To this:
table .text-center {
text-align: center;
}
JSFiddle http://jsfiddle.net/BrTzg/411/
I am dynamically creating tables using ng-table, based on the json data. Ng-tables automatically adjust their height based on the amount of rows.
Is there a way that I can fix the size of the tables, so all of them are of the same size, based on the table with the maximum rows (maximum height)?
You can do it by wrapping your table tag inside a div and then give height to that wrapper div. Give height and width to wrapper div and also give overflow-y:scroll
CSS
#scrollable-area {
margin: auto;
width: 80%;
height: 150px;
border: 2px solid #ccc;
overflow-y: scroll; /* <-- here is what is important*/
}
HTML
<div id="scrollable-area">
<table ng-table="tableParams" class="table">
</table>
</div>
Plunkr here
I'm pulling my hair here. Trying to come up with a simple responsive layout where two fluid boxes are aligned next to each other. The main box must always be centered in the browser window, while the other should be aligned beside it in its top right corner. See example image below -
Tried different approaches involving negative percentages and three-column faux layouts but it just doesn't work.
Demo: http://dabblet.com/gist/7201560
Markup:
<div class='container'>
<div class='main-col'></div>
<div class='right-col'></div>
</div>
CSS:
.container {
text-align: center;
}
.main-col, .right-col {
display: inline-block;
vertical-align: top;
text-align: left;
margin-right: -4px; /* css-tricks.com/fighting-the-space-between-inline-block-elements/ */
}
.main-col {
width: 50%;
margin-left: 20%; /* equal to .right-col's width */
}
.right-col {
width: 20%;
}
What's happening here:
The centered main column and right column have display: inline-block, and they're centered in the viewport by giving their container text-align: center. They're still not centered the way you want though. Since they're sibling elements you can use margin to push the main column to the left with a value equal to right-column's width, essentially centering itself.
Hi you can check my try in this link http://jsfiddle.net/WHq8U/17/.
I had to use a little jquery to calculate the sidebar absolute position. Let me know your opinion about this.