-
1. Re: Select item from table and convertEntity
nickarls Jan 23, 2008 1:46 AM (in response to brachie)Well, you could have two separate components:
* selectOneMenu rendered when list.count < n
* separate modal window with datatable, paginator, search and filtering
I think you should be able to get both options working with a list of entities in the model. Then there is the question on how you should trigger the modal window. A separate button? An empty selectOneMenu with some sort of "on open trigger"? -
2. Re: Select item from table and convertEntity
brachie Jan 23, 2008 3:32 AM (in response to brachie)"nickarls" wrote:
Well, you could have two separate components:
* selectOneMenu rendered when list.count < n
* separate modal window with datatable, paginator, search and filtering
I think you should be able to get both options working with a list of entities in the model. Then there is the question on how you should trigger the modal window. A separate button? An empty selectOneMenu with some sort of "on open trigger"?
I would have a little icon next to the input field which will trigger the popup with the person-selection table.
My main concern is not how to trigger the popup etc, it is how do I set the selected person directly to the entity (pass it to the project.setManager(Person p) method!
What I tried is (this is the person-select table in the popup):<tr:table styleClass="trTableDiv" id="personss" rows="10" columnClasses="col" value="#{allPersons}" var="pers"> <tr:column> <f:facet name="header">Name</f:facet> <h:outputText value="#{pers.vorname} #{pers.nachname}" /> </tr:column> <tr:column> <f:facet name="header">select</f:facet> <a:commandLink reRender="panelProjekt" action="#{projekt.setManager(pers)}" value="set"> <s:conversationId /> </a:commandLink> </tr:column> </tr:table>
The problems here are the following:
- only the last person in the table is set to the project if I click a link. Why??
- the project record is immediately updated in the DB after I click the link (maybe here I could use flushMode="manual"?)
- this only works for the first click on the commandLink
Any help would be appreciated.
Alexander -
3. Re: Select item from table and convertEntity
nickarls Jan 23, 2008 3:37 AM (in response to brachie)tried using a s:link?
-
4. Re: Select item from table and convertEntity
brachie Jan 23, 2008 4:14 AM (in response to brachie)So I figured it out: The Trinidad table is the problem here. If I use the standard h:dataTable or rich:datatable it works!!
<rich:dataTable styleClass="trTableDiv" id="personss" value="#{allePersonen}" var="pers"> <rich:column> <f:facet name="header">Name</f:facet> <h:outputText value="#{pers.vorname} #{pers.nachname}" /> </rich:column> <rich:column> <f:facet name="header">select</f:facet> <a:commandLink immediate="true" reRender="panelProjekt" action="#{projekt.setManager(pers)}" value="set"> <s:conversationId /> </a:commandLink> </rich:column> </rich:dataTable>
So here we have another little incompatibility with Trinidad?
But what happens when I click the set link is that the project record is immediately updated in the database. Is there a way to prevent this or do I have to set the flushMode of the conversation to manual? -
5. Re: Select item from table and convertEntity
nickarls Jan 23, 2008 4:16 AM (in response to brachie)I think that is the expected behaviour and manual flushmode should fix that.
-
6. Re: Select item from table and convertEntity
brachie Jan 23, 2008 5:35 PM (in response to brachie)Ok, thanks for your help! It works like I want it now :-)
But can anyone explain to me what happens behind the scene when passing the entity-object (pers in my example) directly as method parameter? Well, it works, but how?
Alexander