我有这个xhtml,其中我有一个p:时间轴...我想当我选择一个对象(训练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");
}
这个方法(onSelect)永远不会被ajax调用! :(
答案 0 :(得分:2)
Showcase示例对我也不起作用。但是将进程属性与封闭表单一起添加为 ajax 标记的值对我有用:
<h:form id="form">
...
<p:ajax
event="select"
listener="#{nav.onSelect}"
process=":form"
/>
...
</h:form>
请注意:添加 @this 或时间线标识符也不起作用!