how to update the dialog in a page with a button in datatabl

UI Components for JSF
Post Reply
senthilkumar.89
Posts: 100
Joined: 29 Jan 2014, 03:41

21 Jan 2015, 11:18

HI guys i have got a issue with the following code
when i click the button in the datatable the dialog box is not updating


Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:pm="http://primefaces.org/mobile"
	xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" template="/template/MobileTemplate.xhtml">

	<ui:define name="content">
		<pm:content styleClass="jqm-content">
			<p:panel id="viewpatientpanel" header="#{patientRecordsBean.page_title}">

				<p:dialog id="search_dialog" header="Search details by Patient ID, or Mobile No, or Name" widgetVar="searchdiag" modal="true" draggable="true" closable="false" maximizable="false" minimizable="false" appendToBody="true" closeOnEscape="true">
					<!-- 				<ui:include src="/templates/SearchButton.xhtml" /> -->
				</p:dialog>

				<p:dialog id="dialog" header="Click 'Download' button to download the file" widgetVar="Dialog" styleClass="ui-panelgrid-footer ui-panelgrid-header" resizable="false" showEffect="explode" hideEffect="explode">
					<h:form id="dialog_form">
						<h:panelGrid id="display" columns="2" cellpadding="4" columnClasses="plabel, pvalue" styleClass="ui-panelgrid">
							<h:outputText value="Patient Id - " />
							<h:outputText value="#{patientRecordsBean.dataModel.patid}" />

							<h:outputText value="Date - " />
							<h:outputText value="#{patientRecordsBean.dataModel.adate}" />

							<h:outputText value="File To be Downloaded - " />
							<h:outputText value="#{patientRecordsBean.dataModel.file_url}" />

							<f:facet name="footer">
								<p:commandButton id="view" value="Download" ajax="false" actionListener="#{patientRecordsBean.FileDownloadApp}" onclick="PF('Dialog').hide()" styleClass="datalist-noborder">
									<p:fileDownload value="#{patientRecordsBean.filecontent}" />
								</p:commandButton>
							</f:facet>
						</h:panelGrid>
					</h:form>
				</p:dialog>

				<!-- 				<p:dialog id="dialog" header="Click 'Download' button to download the file" widgetVar="Dialog" resizable="false" showEffect="explode" hideEffect="explode"> -->
				<!-- 					<h:form id="dialog_form"> -->
				<!-- 						<h:panelGrid id="display" columns="2" cellpadding="4" columnClasses="plabel, pvalue" styleClass="ui-panelgrid"> -->
				<!-- 							<p:outputLabel for="patid" value="Patient Id - " /> -->
				<!-- 							<p:outputLabel id="patid" value="#{patientRecordsBean.dataModel.patid}" /> -->

				<!-- 							<p:outputLabel value="Date - " /> -->
				<!-- 							<p:outputLabel value="#{patientRecordsBean.dataModel.adate}" /> -->

				<!-- 							<p:outputLabel value="File To be Downloaded - " /> -->
				<!-- 							<p:outputLabel value="#{patientRecordsBean.dataModel.file_url}" /> -->

				<!-- 							<f:facet name="footer"> -->
				<!-- 								<center> -->
				<!-- 									<p:commandButton id="view" value="Download" ajax="false" actionListener="#{patientRecordsBean.onRowSelect()}" icon="ui-icon-arrowthick-1-s" onclick="PF('Dialog').hide()" styleClass="datalist-noborder"> -->
				<!-- 										<p:fileDownload value="#{patientRecordsBean.filecontent}"></p:fileDownload> -->
				<!-- 									</p:commandButton> -->
				<!-- 								</center> -->
				<!-- 							</f:facet> -->
				<!-- 						</h:panelGrid> -->
				<!-- 					</h:form> -->
				<!-- 				</p:dialog> -->

				<h:form id="viewAppoint_from">
					<h:panelGrid id="viewpatient_panel" columns="1" columnClasses="plabel, pvalue" styleClass="ui-panelgrid">

						<pm:field>
							<p:outputLabel for="patientid" value="Patient Id" />
							<p:inputText id="patientid" value="#{patientRecordsBean.patientId}" tabindex="1" disabled="#{patientRecordsBean.disable_patientField}">
								<p:ajax event="change" listener="#{patientRecordsBean.fetchPatientDetails}" update="viewAppoint_from" />
							</p:inputText>
							<p:watermark value="Enter Patient Id" for="patientid"></p:watermark>
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_patientDetails}">
							<p:outputLabel for="patName" value="Patient Name" style="font-weight:bold" />
							<p:outputLabel id="patName" value="#{patientRecordsBean.patientName}" rendered="#{patientRecordsBean.render_patientDetails}" />
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_patientDetails}">
							<p:outputLabel for="patage" value="Age" style="font-weight:bold" />
							<p:outputLabel id="patage" value="#{patientRecordsBean.patientAge}" rendered="#{patientRecordsBean.render_patientDetails}" />
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_patientDetails}">
							<p:outputLabel for="patgen" value="Gender" style="font-weight:bold" />
							<p:outputLabel id="patgen" value="#{patientRecordsBean.patientGender}" rendered="#{patientRecordsBean.render_patientDetails}" />
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_patientDetails}">
							<p:outputLabel for="out_in_patient" value="Patient Type" style="font-weight:bold" />
							<p:selectOneRadio value="#{patientRecordsBean.patientType}" id="out_in_patient" tabindex="2" rendered="#{patientRecordsBean.render_patientDetails}">
								<f:selectItem itemLabel="Out Patient" itemValue="Out Patient" />
								<f:selectItem itemLabel="In Patient" itemValue="In Patient" />
								<p:ajax event="change" listener="#{patientRecordsBean.fetchpatientRecord}" update="viewAppoint_from out_in_patient " />
							</p:selectOneRadio>
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_addmission}">
							<!--To get the date of admission-->
							<p:outputLabel for="dateofadmission" value="Date of Admission" style="font-weight:bold" />
							<p:selectOneMenu value="#{patientRecordsBean.admissionDate}" id="dateofadmission" tabindex="5" rendered="#{patientRecordsBean.render_addmission}">
								<f:selectItems value="#{patientRecordsBean.admissionList}" />
								<p:ajax event="change" listener="#{patientRecordsBean.fetchaccord}" update="viewAppoint_from dateofadmission" />
							</p:selectOneMenu>
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_recordtype}">
							<p:outputLabel for="patRecord" value="Record Type" style="font-weight:bold" />
							<p:selectOneRadio value="#{patientRecordsBean.recordType}" id="patRecord" tabindex="2" rendered="#{patientRecordsBean.render_recordtype}">
								<f:selectItem itemLabel="Billing Records" itemValue="billing" />
								<f:selectItem itemLabel="Medical Records" itemValue="medical" />
								<p:ajax event="change" listener="#{patientRecordsBean.fetchRecord}" update="viewAppoint_from patRecord" />
							</p:selectOneRadio>
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_selectrecord}">
							<p:outputLabel for="selectRecord" value="Select Record" style="font-weight:bold" />
							<p:selectOneMenu value="#{patientRecordsBean.patientRecord}" id="selectRecord" tabindex="6" rendered="#{patientRecordsBean.render_selectrecord}" style="font-size:12px;">
								<f:selectItems value="#{patientRecordsBean.recordTypes}" />
								<p:ajax event="change" listener="#{patientRecordsBean.fetchRecordDetails}" update="viewAppoint_from downloadTable selectRecord" />
							</p:selectOneMenu>
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_appointment}">
							<!--To get the date of appointment-->
							<p:outputLabel for="dateofappointment" value="Date of Appointment" style="font-weight:bold" />
							<p:selectOneMenu value="#{patientRecordsBean.appointmentDate}" id="dateofappointment" tabindex="5" rendered="#{patientRecordsBean.render_appointment}">
								<f:selectItems value="#{patientRecordsBean.appointmentList}" />
								<p:ajax event="change" listener="#{patientRecordsBean.enablePrint}" update="viewAppoint_from" />
							</p:selectOneMenu>
						</pm:field>

						<pm:field rendered="#{patientRecordsBean.render_caseRecord}">
							<!--This is for Case Record Get the case records numbers -->
							<p:outputLabel for="caserecordno" value="Case Record Time" style="font-weight:bold" />
							<p:selectOneMenu value="#{patientRecordsBean.caserecordNo}" id="caserecordno" tabindex="7" rendered="#{patientRecordsBean.render_caseRecord}">
								<f:selectItems value="#{patientRecordsBean.caserecordList}" />
								<p:ajax event="change" listener="#{patientRecordsBean.enablePrint}" update="viewAppoint_from" />
							</p:selectOneMenu>
						</pm:field>

						<f:facet name="footer">
							<center>
								<p:commandButton id="prindialog" value="Print" ajax="false" actionListener="#{patientRecordsBean.getPdf}" rendered="#{patientRecordsBean.render_print}">
									<p:fileDownload value="#{patientRecordsBean.filecontent}" />
								</p:commandButton>
								<p:outputLabel value="&#8195;" />
								<p:commandButton value="Reset" action="#{patientRecordsBean.setCleardetails()}" update="viewAppoint_from" />
								<p:outputLabel value="&#8195;" />
								<p:commandButton id="carBtn" value="Search Patient Details" type="button" onclick="PF('searchdiag').show();" tabindex="12" rendered="#{patientRecordsBean.disable_patientField eq true? false:true}" />

							</center>
						</f:facet>
					</h:panelGrid>
					<p:dataTable id="downloadTable" var="temp" value="#{patientRecordsBean.fileDowldDataModels}">

						<p:column headerText="File Download">
							<h:outputText value="#{temp.file_url}" />
							<div style="text-align: right;">
								<p:commandButton icon="ui-icon-search" styleClass="ui-btn-inline" oncomplete="PF('Dialog').show();" title="Download" update=":viewpatientpanel:dialog:dialog_form:display">
									<h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" />
									<f:setPropertyActionListener value="#{temp}" target="#{patientRecordsBean.dataModel}" />
								</p:commandButton>
							</div>
						</p:column>

					</p:dataTable>
				</h:form>
			</p:panel>
		</pm:content>
	</ui:define>

</ui:composition>
Regards
Senthil Kumar

Jsf 2.1,2.2, Primefaces 3.5, Primefaces 4.0,
Primefaces Mobile 0.9.5
Primefaces 5.0.RC1,Primefaces 5.2,Primefaces Extentsions 3.2.0.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

21 Jan 2015, 16:08

Hi...

I get a billion errors when pasting your code in a clean test... And Lots and lots of superfluent comments in there (are the comments actually disabled in your faces-config?)

http://stackoverflow.com/help/mcve

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests