简体   繁体   中英

Primefaces 3.5 Dashboard Component

I want to implement the pf 3.5 dashboard component I am using this in my *.xhtml Page:

                <p:growl id="growl" showDetail="true" />

                <p:dashboard id="board" model="#{dashboardBean.model}">
                    <p:ajax event="reorder" listener="#{dashboardBean.handleReorder}"
                        update="growl" />

                    <p:panel id="products" header="Products">
                        <h:outputText value="Product Content" />
                    </p:panel>

                    <p:panel id="plans" header="Plans">
                        <h:outputText value="Plans Content" />
                    </p:panel>

                    <p:panel id="notes" header="Notes">
                        <h:outputText value="Notes Content" />
                    </p:panel>
                </p:dashboard>

and as my backend:

I am using the same bean as from the link above and:

public DashboardBean() {  
    model = new DefaultDashboardModel();  
    DashboardColumn column1 = new DefaultDashboardColumn();  
    DashboardColumn column2 = new DefaultDashboardColumn();  
    DashboardColumn column3 = new DefaultDashboardColumn();  

    column1.addWidget("products");  

    column2.addWidget("plans");  

    column3.addWidget("notes");  

    model.addColumn(column1);  
    model.addColumn(column2);  
    model.addColumn(column3);  
} 

However, when I open my page on my server nothing gets shown up. My html output:

<form id="form" enctype="application/x-www-form-urlencoded" action="/ProductOverview.xhtml" method="post" name="form">
<input type="hidden" value="form" name="form">
<span id="form:growl"></span>
<div id="form:board" class="ui-dashboard"></div>
<input id="j_id1:javax.faces.ViewState:0" type="hidden" autocomplete="off" value="-5329509311621774370:-4596343252720161135" name="javax.faces.ViewState">
</form>

I really appreciate your reply!

Add a @ManagedBean and @SessionScoped (for example) annotations,

Like this

@ManagedBean 
@SessionScoped 
public DashboardBean(){

Your xhtml page probably has an error. You are reffering to #{dashboardBean.handleReorder} which I can not see in your code(unless you didnt post it), if there is no method handleReorder in your bean then it will not correctly build your page.

So remove the listener method or create it method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM