我有一个xhtml,其中有一个p:timeline。。。我想在选择一个对象(training pLan)时,显示一个包含详细信息的模式对话框。但我无法触发select事件。。。该方法永远不会被调用!
这是我的xhtml代码
<fieldset class="scheduler-border">
<legend class="scheduler-border">#{msg['tp_list']}</legend>
<p:timeline id="timeline" value="#{nav.model}" height="450px" selectable="#{nav.selectable}" zoomable="# {nav.zoomable}" moveable="#{nav.moveable}" stackEvents="#{nav.stackEvents}" axisOnTop="#{nav.axisOnTop}" eventStyle="#{nav.eventStyle}" showCurrentTime="#{nav.showCurrentTime}" showNavigation="#{nav.showNavigation}">
<p:ajax event="select" listener="#{nav.onSelect}" />
</p:timeline>
</fieldset>
这是我的豆子:
@Named("nav")
@ViewScoped
private TimelineModel model;
private boolean selectable = true;
private boolean zoomable = true;
private boolean moveable = true;
private boolean stackEvents = true;
private String eventStyle = "box";
private boolean axisOnTop;
private boolean showCurrentTime = true;
private boolean showNavigation = false;
.
.
.
@PostConstruct
protected void initialize() {
LOGGER.info("In post-Construct INITIALIZE!");
model = new TimelineModel();
allPlans = tPlanService.getAllTPlan();
for (TrainingPlan tp : allPlans) {
LOGGER.info("IN FOR: " + tp.getEndDate());
model.add(new TimelineEvent(tp.getName(), tp.getStartDate(), tp.getEndDate()));
}
}
public void onSelect(TimelineSelectEvent e) {
LOGGER.info("In onSelect of NAV");
TimelineEvent timelineEvent = e.getTimelineEvent();
facesMessageBox.infoMessage("Selected event:", "aaaaaaaaaaaaaaaaaaaaa");
}
ajax从未调用此方法(onSelect)!:(
Showcase示例对我也不起作用。但是,将process属性和封闭形式作为值添加到ajax标记对我有效:
<h:form id="form">
...
<p:ajax
event="select"
listener="#{nav.onSelect}"
process=":form"
/>
...
</h:form>
请注意:添加@this或时间线标识符也不起作用!