JSF Primefaces时间轴添加一个值

时间:2015-05-04 16:43:05

标签: jsf primefaces timeline

如何在Primefaces时间轴中添加其他参数/​​属性?我测试过:

<f:param name="action" value="delete" />
<f:attribute name="action" value="delete" />

但不幸的是,这在时间轴上不起作用,是否有可能以不同的方式?

1 个答案:

答案 0 :(得分:0)

At Facelet, you can use an ajax event to send a delete request:

<pe:timeline value="#{yourBean.model}">  
    <p:ajax event="delete" listener="#{yourBean.onDelete}" />  
</pe:timeline>

At Bean, you can get/delete the underlying object with:

public void onDelete(TimelineModificationEvent e) {  
   TimelineEvent event = e.getTimelineEvent();  
    // >> delete 'event' here...
}

This you tell you which event is supposed to be deleted. If you need additional parameters, you should prepare them in the model, in advance.

TimelineEvent ev = new TimelineEvent(yourCustomObject, startDate, endDate);
// add it to the model...

You can find how to delete stuff from timeline at the official docs. There you have a confirmation dialog if you need.