Touchfaces: dynamic count of table groups

UI Components for JSF
Post Reply
rosemeyer2
Posts: 55
Joined: 05 Oct 2009, 16:04

11 Oct 2009, 18:32

I am aware of the odds and ends with jsf and repeating tags as c:forEach or ui:repeat, but as a datatable doesn't work with touchfaces (ot pretty), I would like to find a way, to dynamically create rowGroup and rowItems.

My bean provides a map which has a String key and a list value. For each of these lists a rowGroup should be created and the items of the list should be rendered as tableItems. The key goes into the rowGroup name. I tried with forEach and ui:repeat, but it doesn't work out:

Code: Select all

                 <i:view id="aview" title="A View">
			<f:facet name="leftNavBar">
				<i:navBarControl label="Home" view="home" />
			</f:facet>
			<h:form prependId="false">
				<i:tableView id="aTable" display="group">
					<ui:repeat value="#{myBean.groups}" var="group">
						<i:rowGroup title="#{group.key">
							<ui:repeat var="aItem" value="#{group.value}">
								<i:rowItem>
									<h:outputText value="#{aItem.name}" />
								</i:rowItem>
							</ui:repeat>
						</i:rowGroup>
					</ui:repeat>
				</i:tableView>
			</h:form>
		</i:view>
Primefaces 2.0.2 - Mojarra 2.0.2 - Windows XP SP3 - IE 8 / Firefox 3.6

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

11 Oct 2009, 19:57

I've done almost the same thing in news touchfaces app;

http://code.google.com/p/primefaces/sou ... news.xhtml

See the ui:repeate usage there. Are you sure the groups are populated, also I've seen a typo at <i:rowGroup title="#{group.key">.

rosemeyer2
Posts: 55
Joined: 05 Oct 2009, 16:04

12 Oct 2009, 18:05

This typo was just in the forum entry, but not in the code. Your news example is based on a list and is just iterating over a list. This works for me, too. But iterations over groups and items do not work.
Primefaces 2.0.2 - Mojarra 2.0.2 - Windows XP SP3 - IE 8 / Firefox 3.6

rosemeyer2
Posts: 55
Joined: 05 Oct 2009, 16:04

13 Oct 2009, 19:12

Any chance to get this working?
Primefaces 2.0.2 - Mojarra 2.0.2 - Windows XP SP3 - IE 8 / Firefox 3.6

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

14 Oct 2009, 01:34

Hi, can you provide the java code for myBean as well.

rosemeyer2
Posts: 55
Joined: 05 Oct 2009, 16:04

14 Oct 2009, 07:55

xhtml fragment:

Code: Select all

<i:tableView id="tickerTable" display="group">
					<ui:repeat value="#{tickerBean.gameGroups}" var="group">
						<i:rowGroup title="TEST">
							<ui:repeat var="spiel" value="#{group.value}">
								<i:rowItem>
									<h:outputText value="#{spiel.heimKurz}" /> -
									<h:outputText value="#{spiel.gastKurz}" />
									<h:outputText value=" " />
									<h:outputText value="#{spiel.spielErgebnis}" />
									<h:outputText value=" " />
									<h:outputText value="#{spiel.drittelErgebnis}" />
								</i:rowItem>
							</ui:repeat>
						</i:rowGroup>
					</ui:repeat>
				</i:tableView>
Bean:

Code: Select all

package hockey.controller.bean;

import hockey.bean.SpielBean;
import hockey.db.HockeyRepository;

import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.faces.event.ActionEvent;

public class CopyOfTickerBean {
	
	private Map<String, List<SpielBean>> gameGroups = new HashMap<String, List<SpielBean>>();

	public void clickTicker(ActionEvent actionEvent) {
            HockeyRepository rep = HockeyRepository.getInstance();
            Calendar cal = Calendar.getInstance();
            
            // Create gameGroup map
            this.gameGroups = rep.getGroups(cal);
	}

	public Map<String, List<SpielBean>> getGameGroups() {
		return gameGroups;
	}

	public void setGameGroups(Map<String, List<SpielBean>> gameGroups) {
		this.gameGroups = gameGroups;
	}
}
Primefaces 2.0.2 - Mojarra 2.0.2 - Windows XP SP3 - IE 8 / Firefox 3.6

rosemeyer2
Posts: 55
Joined: 05 Oct 2009, 16:04

17 Oct 2009, 02:10

Any news on that?
Primefaces 2.0.2 - Mojarra 2.0.2 - Windows XP SP3 - IE 8 / Firefox 3.6

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

19 Oct 2009, 12:12

I think using two inner ui:repeats is the problem. Have you tried with c:forEach(s)?

rosemeyer2
Posts: 55
Joined: 05 Oct 2009, 16:04

19 Oct 2009, 18:41

Yes, I tried c:forEach first, because intentionally I didn't include facelets. Was not working either.
Primefaces 2.0.2 - Mojarra 2.0.2 - Windows XP SP3 - IE 8 / Firefox 3.6

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests