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?
Related
I have p:dialog, inside there is p:panelGrid, and one of column is p:dataTable. Datatable has selectionmode single. Problem is: dataTable loses all styling it defaulty had (it looks like pure unstyled html table). Also when i click row in dataTable, row is invisible, no data is shown. Also rowSelect functionally works, because data from selected row displays in input fields in another outputPanel correctly. Its just invisible
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.
I have a tree of categories (types) to be showed inside a <p:slideMenu>, I want to select the category showed inside the label of <p:submenu>, and not show its subcategories (contained inside a list of <p:menuitem> tags).
Is there any way to solve this issue, for example add a button in front of each <p:submenu> and when I click the button the current <p:submenu> is selected and its value is sent to a backing bean, and when I click on the label contained inside <p:submenu> the subcategories will be shown.
I am using primefaces 3.5.
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
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.