Timeline with commandLink

Community Driven Extensions Project
Post Reply
vished
Posts: 479
Joined: 02 Feb 2014, 17:38

22 Mar 2015, 22:24

Dear all,

I want to have a p:commandLink in my events. This link will open a p:dialog with the details for the selected events.
How can I get the selected event in bean?

I try follwing, but selectedJob is everytime null.
How should lools like my mehod in the bean?
Which class / paremeter should I use in the onChange method?
I tried also to cast the TimeLineEvent to my own class Job.

Backing Bean:

Code: Select all

	private TimelineModel model = new TimelineModel();
	private Job selectedJob;

Code: Select all

public void onChange(Job job) {  
        selectedJob = job;
      } 

XHTML page:
<pe:timeline id="timeline" value="#{timelineJobController.model}"
var="job" zoomMax="#{timelineJobController.zoomMax}"
start="#{timelineJobController.startDate}"
end="#{timelineJobController.endDate}" editable="true"
showButtonNew="false" minHeight="400" showNavigation="true"
widgetVar="timelineWdgt" stackEvents="true" axisOnTop="true"
locale="#{localeBean.selectedLanguageGeneral.isoCode}">

<p:ajax event="lazyload" update="@none"
listener="#{timelineJobController.onLazyLoad}"/>

<p:ajax event="change" update="@none" listener="#{timelineJobController.onChange}"/>


<p:commandLink value="#{job.jobName}" update=":jobDetailsForm" resetValues="true" actionListener="#{timelineJobController.onChange(job)}"
oncomplete="PF('jobDetailsDialog').show()" />


</pe:timeline>
</h:form>
</div>
</div>



Code: Select all

		<p:dialog message="Details zu #{timelineJobController.selectedJob.jobName}" header="Job Details" width="700"
			draggable="true" resizable="true" closeOnEscape="true"
			appendTo="@(body)" modal="true" widgetVar="jobDetailsDialog">

			<h:form id="jobDetailsForm">

				<div class="modal-body">

					<div class="form-horizontal">

						<div class="form-group">
							<p:outputLabel value="Projektname:"
								class="col-md-4 control-label" />
							<div class="col-md-8">
								<h:outputText value="#{timelineJobController.selectedJob.jobName}" />
							</div>
						</div>


						<div class="form-group">
							<p:outputLabel value="Kategorie:" class="col-md-4 control-label" />
							<div class="col-md-8">
								<h:outputText value="#{timelineJobController.selectedJob.jobCategory.name}" />
							</div>
						</div>

						<div class="form-group">
							<p:outputLabel value="Kunde:" class="col-md-4 control-label" />
							<div class="col-md-8">
								<h:outputText
									value="#{timelineJobController.selectedJob.customer.surname} #{timelineJobController.selectedJob.customer.name}" />
							</div>
						</div>
....
Could you help me, please.
PF 8.0

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

26 Mar 2015, 15:42

Please try to create a SIMPLE and good formatted example, so that we can understand and check it.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests