Bug when using modal inside datatable

UI Components for JSF
Post Reply
luccotta
Posts: 15
Joined: 25 Mar 2015, 03:01

25 Mar 2015, 04:53

I'm using PrimeFaces 4.0

Please, take a look in my code bellow. In my understanding I had to put the modal inside the datatable in order to access the "var" from the datatable.

The bug is: intermittently, a big blank space appear bellow the button "numbersButton", for each line in my datatable. This space has the same height as my modal. So it's like sometimes the JSF tries to show the modal when the user enter in the page, but then it remembers it is a modal, does not show it anymore, but leave its space there. Does anybody have any idea how could I avoid this?

Thanks!

Code: Select all

<p:dataTable 
	id="lotteryTicketsTable" 
	var="lotTicTableVar"
	value="#{myBean.lotteryTicketList}"
	editable="true" 
	editMode="cell" 
	styleClass="geralBorderless">

	<p:column headerText="Lottery ticket name" >
		<p:inputText
			value="#{lotTicTableVar.name}"
			id="empName" />			
	</p:column>

	<p:column headerText="Lottery ticket numbers" >

		<p:commandButton 
			value="Click to insert chosen numbers" 
			id="numbersButton" 
			update=":form:lotteryTicketsTable:numbersModal"
			oncomplete="modalNumbers.show();" >
		</p:commandButton>

		<p:dialog 
			id="numbersModal" 
			closable="false" 
			widgetVar="modalNumbers" 
			modal="true" 
			closeOnEscape="false" 
			resizable="false" >

			<p:dataGrid 
				id="numbersTable" 
				var="numTableVar"
				value="#{lotTicTableVar.numberList}"
				columns="10" 
				editable="true" 
				editMode="cell">

				<table><tr><td>
							<p:inputMask maxlength="2" mask="99" 
								value="#{numTableVar.number}" 
								id="number"
							/>
				</td></tr></table>

			</p:dataGrid>
			
			<p:commandButton id="save" 
				value="Save and Close" 
				actionListener="#{lotTicTableVar.verifyNumber}"
				update="numbersTable" 
				oncomplete="modalNumbers.hide()"
			/>
				
		</p:dialog>

	</p:column>
</p:dataTable>

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

25 Mar 2015, 17:33

No idea where you found an example like this. Check the first one here: http://www.primefaces.org/showcase/ui/d ... tion.xhtml

luccotta
Posts: 15
Joined: 25 Mar 2015, 03:01

26 Mar 2015, 18:41

Well, that only made the intermittent blank space appear somewhere else.
But I googled it a little more and in the end this CSS solved my issue:

Code: Select all

.ui-dialog{        
       position: fixed !important;
}
Thanks!

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

26 Mar 2015, 19:48

Weird fix. .. never needed that. But if it works for you

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests