Hello Community!
I really like this component, however i can't do the next thing: I want to iterate (maybe with "ui:repeat"?) and add panels to the first column of the dashboard... is it possible? 'Cause I only find, like showcase example, the method with and "static id"... and "id" can't be replicated of course...
Cheers!
[Solve] Dashboard Panels from Bean?
Okey, I've resolve watching others posts and finally binding Dashboard component. The solution is similarly to the next one:
CrearHojaDeRutaController.java (It's important, when binding components to back beans, keeping the RequestScoped...)
HojaRuta.xhtml
Cheers!
CrearHojaDeRutaController.java (It's important, when binding components to back beans, keeping the RequestScoped...)
Code: Select all
@Named(value = "crearHojaDeRutaController")
@RequestScoped
public class CrearHojaDeRutaController {
private Dashboard dashboard;
public CrearHojaDeRutaController() {
FacesContext fc = FacesContext.getCurrentInstance();
Application application = fc.getApplication();
dashboard = (Dashboard) application.createComponent(fc, "org.primefaces.component.Dashboard", "org.primefaces.component.DashboardRenderer");
dashboard.setId("dashboard");
DashboardModel model = new DefaultDashboardModel();
DashboardColumn column1 = new DefaultDashboardColumn();
DashboardColumn column2 = new DefaultDashboardColumn();
model.addColumn(column1);
model.addColumn(column2);
dashboard.setModel(model);
List<String> actividades = new ArrayList<String>();
for (int i = 0; i < 5; i++) {
actividades.add("Task" + i);
}
for (String act : actividades) {
Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer");
panel.setId(act);
panel.setHeader("Actividad");
panel.setClosable(true);
panel.setToggleable(true);
dashboard.getChildren().add(panel);
column1.addWidget(panel.getId());
HtmlOutputText text = new HtmlOutputText();
text.setId("t"+act);
text.setValue("Contenido de la Actividad ");
panel.getChildren().add(text);
}
}
//Getters / Setters
Code: Select all
<h:form>
<p:dashboard id="board" binding="#{crearHojaDeRutaController.dashboard}">
</p:dashboard>
</h:form>
Netbeans 6.9.1 + Glassfish v3 + PrimeFaces 2.2.RC2
-
- Information
-
Who is online
Users browsing this forum: No registered users and 23 guests