Im using glassfish 3.0.1 and was experimenting with columnClasses in dataTable for the first time.
It's something like this :
<h:dataTable value="#{coreGridBean.heroBeanList}" var="hero"
captionStyle="font-size: 0.95em; font-style:italic"
styleClass="orders"
headerClass="ordersHeader"
footerClass="ordersHeader"
columnClasses="oddColumn,evenColumn">
From the core jsf book im reading, it says that by specifying only 2 classes in the columnClasses attribute, those 2 will be repeated when the column amount is more than 2.
Let's say that i have five columns, the columnClasses would become something like oddColumn,evenColumn,oddColumn,evenColumn,oddColumn, and we just need to define it like this : columnClasses="oddColumn,evenColumn"
But in my experience with 3 columns, it's not like this. From the third column they got no classes. I had to specify columnClasses="oddColumn,evenColumn,oddColumn" to make it work
Is this a bug or i just have a bad error ?
The repetition only applies on rowClasses.
From the JSF 2.0 h:dataTable tag documentation:
columnClasses
Comma-delimited list of CSS style classes that will be applied to the columns of this table. A space separated list of classes may also be specified for any individual column. If the number of elements in this list is less than the number of actual column children of the UIData, no "class" attribute is output for each column greater than the number of elements in the list. If the number of elements in the list is greater than the number of actual column children of the UIData, the elements at the posisiton in the list after the last column are ignored.
rowClasses
Comma-delimited list of CSS style classes that will be applied to the rows of this table. A space separated list of classes may also be specified for any individual row. Thes styles are applied, in turn, to each row in the table. For example, if the list has two elements, the first style class in the list is applied to the first row, the second to the second row, the first to the third row, the second to the fourth row, etc. In other words, we keep iterating through the list until we reach the end, and then we start at the beginning again.
Maybe the book was wrong, or you misread the book.
Since the column number is usually always fixed in the view definition anyway, it's little effort to just repeat them yourself.
<h:dataTable columnClasses="oddColumn,evenColumn,oddColumn,evenColumn">
<h:column></h:column>
<h:column></h:column>
<h:column></h:column>
<h:column></h:column>
</h:dataTable>
Related
I'm currently pulling the top (5) number of numerical values from one sheet and inputting them into a different sheet. Each number is within its own column and there is a name matching that column, EX:
And so, having a tie is common with the data that I'm working with, so it nearly deprecates my formulas.
For getting the name:
=INDEX('Total Cases by Categories'!$B$18:$B$50, MATCH(LARGE('Total Cases by Categories'!$H$18:$H$50, A39),'Total Cases by Categories'!$H$18:$H$50, 0))
For getting the numerical value associated with the name:
=LARGE('Total Cases by Categories'!$H$18:$H, A39)
And so, when there are 2 people with the same numerical value associated within a category, then that person appears twice, I assume because of their position within the sheet.
So something like this happens:
So in the event of a tie, I would want to list both names that have the same amount of points instead of the first name that shows up with the duplicated value.
Any help would be appreciated!
Actually, LARGE will give you both of tied names. It's MATCH that can't look beyond the first. To the best of my knowledge there is no way around that (the difficult one being not to use MATCH). Therefore the solution is to have no ties.
This is achieved with helper columns that contain no identical numbers. This can be achieved by adding an insignificant decimal. Since you are dealing with integers, adding 0.1 would be insignificant for your purposes but 13.1 is different from 13.2. If you need to extract the "real" number from this use INT(13.2).
Using the row number to generate an insignificant decimal is popular for this purpose. In row 1 ROW()/10 will return 0.1. But in row 10 ROW()/10 will return 1.0 which isn't an insignificant number anymore. Therefore you have to work with ROW()/100 or an even larger divisor, depending upon how many rows you have. Try ROW()/10^6 - any decimal will do the tie-breaking job.
You may not like that using ROW() will list tied participants in the order in which they appear in the worksheet. The differentiating decimals can be created by any other means that doesn't create ties in itself.
Normally, the helper columns with the decimals added will be hidden. They contain a formula like =D23 + (ROW()/10000) which manages itself. You can then use that column for the MATCH function to list all participants in the order of LARGE using the helper column or the original. Just make sure that MATCH refers to the helper column.
I would like to display a list of information per entry in the table. For example for each user, one can have multiple cell phone numbers.
The users are listed in the and I have an for the cell numbers. I would like to loop through the list of numbers per user and list them in the column for the cell phone numbers.
I have tried to add the ui:repeat in the in the following way:
<ui:repeat value="#{user.cellNumbers}" var="cellNumber">
and the table holds the user array in the following manner:
<af:table id="t1-rapb" value="#{userBean.users}" var="user">
I expected the ui:repeat to iterate through the list of numbers per user, but instead nothing appears in that column. What am I missing in order to make this work?
I would like to swap two columns in JSF h:dataTable based on a condition. For instance if a user chooses red, then the column with red values comes first. If he chooses the other color say blue then the column with blue values comes first and the other afterwards.
I have played with the rendered attribute but it is not working.
If you use Primefaces you can bind the columns to a collection in the server side, so you can filter and rearrange columns as you like
Example:
https://www.primefaces.org/showcase/ui/data/datatable/columns.xhtml
With plain JSF I don't think that's possible, but you could go with a client approach such reordering the <td> elements with jQuery.
I would like to render a group of name-value only if a value is not null (or another condition). This group of name is among other names and values which are always rendered.
To format the page, I use a <h:panelGrid columns="2">.
If I use a <h:panelGroup rendered='thecondition'> the alignment does not work. I tried <ui:fragment> and it didn't work either.
The group contains a large number of values and I would like not to add a rendered attribute for each name and each value of the group. Is there another solution?
I was reading the following link, which provides an introduction to composite columns and I had few doubts, specially regarding the usage of ComponentEquality.EQUAL and ComponentEquality.GREATER_THAN_EQUAL.
In the following example:
Composite start = compositeFrom(startArg, Composite.ComponentEquality.EQUAL);
Composite end = compositeFrom(startArg, Composite.ComponentEquality.GREATER_THAN_EQUAL);
start.addComponent(1,"CA",Composite.ComponentEquality.EQUAL);
end.addComponent(1,"CA",Composite.ComponentEquality.GREATER_THAN_EQUAL);
I'm unable to comprehend why the end component needs GREATER_THAN_EQUAL as equality component.
An explanation with example would be really helpful
The way a slice query works in cassandra is that you specify a start column and an end column(limit/isDescending flag too but that is irrelevant here). One way of querying for your use case would be to pass the complete (Composite)column name for the first composite column that starts with US:CA and the last composite column that starts with US:CA. However, you do not know this in advance.
The good thing about slice queries is that the start and end columns do not need to be actual column names. Since column names are always sorted, if the start column in the slice query does not exist, cassandra will start from the next column greater than the start column provided.
So, we need to construct a start column and an end column for your query. As described in the link, a composite object has an e-o-c bit. This bit is used by slice queries.
A composite column has several components. Each component has the e-o-c bit. When a component has this bit set to Equal, Cassandra moves on to look at the next component. When a component has this bit set to GREATER_THAN_EQUAL, Cassandra will keep on looking at columns, until it finds something whose respective component is not equal to the component we are looking for.
So, now consider the example in the link: We want to do a slice query on a column family which has a composite comparator with three components. We want to get all columns where the first component is US and the second component equal to CA.
We have to create a start column and an end column. The start column will have two components(both with EQUAL as e-o-c) and the end column will have first component as EQUAL and the second component as GREATER_THAN_EQUAL. This will match all the columns whose first component is US and second component is CA.
If you set this bit to EQUAL, a slice query will match the first column it finds with start component is equal to 'CA'. This is fine but Cassandra also needs to know the end column for the slice query. For this, it will look at the end composite you provided.
Hope this helped.
EDIT: To make explanation better