Primefaces tabview menu - jsf

Im having a problem with Primefaces tabview. It's tabs consists of selectOneMenu elements that look like this:
`
<p:selectOneMenu value="#{bean.currentItem.marketType}">
<f:selectItems value="#{bean.marketTypes}"/>
</p:selectOneMenu>
`
Now, I show this view as a dialog every time i select row from a dataTable (in order to edit selected record). The strange behavior is: the first time I refresh the page, i select the row, and the dialog pops out correctly. In all tabs of a tabview, all selectOneMenu elements shows correct data for selected record. However, when i close dialog and reopen it by selecing row again, only those selectOneMenu elements shows correct data, which where in a selected tab from a tabview before the dialog was closed.
Does any one know how to keep data in all tabs every time I open a dialog without refreshing the page?

Solved, there is a bug in Primefaces that is described here:
Primefaces tabView executes form validation on tab change

Related

JSF datatable - method always gets called with last element in datatable

I have component thats basically datatable made of list of buttons. Each button opens dialog thats another component, and passes current var of datatable to this component (dialog). Inside dialog there is button that submits element and text. This command button has actionListener=#{beanClass.beanMethod(cc.attrs.passedListElement)}. Problem is element passed to method is always last element in datatable, even if i click in middle element of datatable. Why its happening?

prime face data table with pagination and data table is put inside Tab

every row I have a commandbutton for editing the row. The method action of this commandbutton sets a managed bean property to hide the datatable and to show the edit form. I do this by enclosing the datatable in a panelgroup, and the edit form in another one, and setting the rendered attribute of the panelgroups accordingly to the managed bean property.
The managed bean is Viewscoped, and all the requests I have are non-ajax.
When I click the edit commandbutton on a row of the 1st datatable page, everything works ok.
But if I move to another datatable page using the paginator links, and then I click the edit commandbutton on any row of the page, it doesn't work, because the Viewscoped bean is created again (PostConstruct is triggered), and even I can see that the action method of the clicked commandbutton isn't executed.
I think it has to do with the ajax requests of the paginator (I guess).
Anybody knows how to make it work?
The problem is with the rendered attribute. Take a look here.
A beter way of solving your problem is to make an editable datatable, or if your object is more complex, make your edit page a dialog, and open it with your edit button.

p:commandButton displayed twice after navigating back to page

I have tab registers with a p:commantButton. By clicking on this button I load an entry list in a p:dataTable (about 10,000) to make some selections (navigated to another page). My selection is added to my p:dataTable on the p:tabView, where i clicked on the button. After comming back to the page the two buttons are displayed twice and a click on the same button does not call my java method any more until I refresh the page completely.
Any Idea ?
thanks for your help
my tabview

select All/deselect all checkbox in Datatable JSF without using Javascript

I am making datatable in JSF using (dataTable tag).
I am having several rows in that with check box( selectBooleanCheckbox ) in front of every record.
I have commandLink button for selecting all check box and deselected all check box..
i am trying to select/unselect all checkboxes in the datatable using a single commandLink. As I am trying to set it on the server, I am unable to do so. I have looked around for solutions but could not get how to accomplish on the server side.
thnks

call a custom listener for cancel in p:rowEditor

I have been trying to call a custom listener when the cancel button is clicked in the primefaces rowEditor component. But I am not able to find the correct attribute to do this.
The problem with the cancel button is that it works fine when the row is already present in the dataTable, if I try to add a new row dynamically to the dataTable and click on the cancel button [ if I think that it is not required ], the empty row is shown in the dataTable, when the empty row should be deleted.
Would you please help me out ?
Try like (JSF2 + Primefaces 2.2.1) ...
<p:column headerText="Test">
<p:rowEditor>
<p:ajaxStatus oncomplete="#{yourBean.yourHandleMethod()}"></p:ajaxStatus>
</p:rowEditor>
</p:column>
I am afraid this functionality isn't available out of box. The rowEditor component has built in integration to a dataTable and its own events and listeners for editing a single existing row. The cancel button of the rowEditor component has the sole functionality of toggling the output and input facets of the Primefaces column components.
If you are good at jQuery you may be able to hack the functionality in by finding the DOM element by the cancel button class, jQuery('.ui-icon-close') and assigning a custom javascript event listener but this could be problematic in a dataTable where there are multiple rows and it sounds as if you would like to delete a blank row if Cancel is selected.
A better approach is create an Add New button that displays a dialog with a form. Submitting through the form in the dialog can add the necessary row to your dataTable.

Resources