Reset dialog content

UI Components for JSF
Post Reply
tamizharasi
Posts: 52
Joined: 26 Jun 2011, 22:18

18 Sep 2011, 05:21

Hi,

I am displaying a dialog , in which datatable with checkboxes is displayed. I am having one submit button inside the dialog. After submitting the content of treetable< the backing bean will do some DB operation and the datatable content has to be reset.

I tried data.clear() data.resetValue(). Nothing is working and throwing JS error.

If anyone knows the method to set datatable value, please share...


I am using primefaces2.2 JSF 2.0 and JBOSS 4.2

Cool Mr Ice
Posts: 46
Joined: 17 Sep 2011, 11:53

18 Sep 2011, 10:52

I'm new to this but may be able to help.

If by "reset" you mean update the table with your changes, you will need to make sure the getter for your datatable in the backing bean will return the correct data and then set update="data" on your submit button (assuming p:commandButton or ajax type submit). If you need to "reset" the sort/filter, you could use oncomplete="data.filter();" on your submit button.

Like I said before - full disclosure: I'm new to this.

Also, there is some code that shows what I'm talking about here: viewtopic.php?f=3&t=15061

I doesn't use a dialog, but there is a datatable that reacts to a commandButton in a similar fashion as you describe.
PrimeFaces 3.5
JSF 2.1
Mojarra 2.1.3
Glassfish 3.1.1
Netbeans 7.0.1
JDK 7
JEE 6

tamizharasi
Posts: 52
Joined: 26 Jun 2011, 22:18

18 Sep 2011, 13:40

Hi,

Thx for your response.


I have done all the changes in my backing bean. But while again showing the dialog, two dialog boxes are opened. one with old content and another with new content.


The active is new content but how to vanish the old dialog box. For this issue I am breaking my head.

priminator
Posts: 2
Joined: 01 Feb 2012, 15:43

01 Feb 2012, 15:49

Got the same problem. After trying around, solution is pretty simple. Just add a "<p:ajax event="close" update="myDialogId" />" in the dialog that references the id of the dialog itself.

Like this:

Code: Select all

	<p:dialog id="myDialog" modal="true" widgetVar="myDialog" dynamic="true" resizable="false" maximizable="false">
	    <p:ajax event="close" update="myDialog"/>
	    <h:form id="myForm" enctype="multipart/form-data">
			<h:panelGrid id="grid" columns="3" columnClasses="col1,col2,col3">
				<h:panelGroup><h:outputText value="Some Value"/></h:panelGroup>	
				<h:panelGroup><h:inputText id="someValue" value="#{myBean.someValue}"/></h:panelGroup>
				<h:panelGroup><p:message for="someValue" /></h:panelGroup>
			</h:panelGrid>
	        <p:commandButton value="#{messages.label_close}" onclick="myDialog.hide()" type="button" />
	    </h:form>
	</p:dialog>
It will reload the dialog html part and thus create and reference a new dialog.

Currently this works unter PF 3.0

Hope this helps!

Regards!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 15 guests