-
1. Re: Ajax4jsf and dataTable question
ilya_shaikovsky Apr 4, 2007 7:34 AM (in response to kristein)http://livedemo.exadel.com/a4j-repeat-rerender
Look please througn this example.
Also you may read http://jroller.com/page/a4j?entry=ajax_updates_inside_jsf_complex1[/url] -
2. Re: Ajax4jsf and dataTable question
kristein Apr 4, 2007 11:01 AM (in response to kristein)Thanks ilya_shaikovsky,
I'll try to solve my problem using the examples mentioned above -
3. Re: Ajax4jsf and dataTable question
kristein Apr 4, 2007 12:14 PM (in response to kristein)Hi,
I've a question
do I need to use Facelet's <ui:repeat> tag for using the <a4j:repeat> component?
I have a dataTable with columns ProdCode,ProposedPrice and ProposedGrossMargin.In which ProposedPrice and ProposedGrossMargin are editable columns.
If I change value of ProposedPrice of a particular row then it should dynamically update ProposedGrossmargin column of that row.
Now, how to use the <a4j:repeat> tag around the <h:inputText> tag.I am in very much confused state.I am new to ajax4jsf, I don't have any knowledge about this before.
Please.. help me how to do this with a piece of code.
Any help is highly appreciated -
4. Re: Ajax4jsf and dataTable question
kristein Apr 4, 2007 2:19 PM (in response to kristein)please anybody help me to solve this problem.
thanks and regards
kristien -
5. Re: Ajax4jsf and dataTable question
sergeysmirnov Apr 4, 2007 3:11 PM (in response to kristein)Your use case is more about using a4j:support than a4j:repeat.
I am not sure I exactly understand the example. As far as I understand, both ProposedPrice and ProposedGrossMargin are input fields. So, if ProposedGrossMargin is calculated based on ProposedPrice how it is possible the user can edit ProposedGrossMargin also manually after it is calculated? -
6. Re: Ajax4jsf and dataTable question
kristein Apr 4, 2007 3:38 PM (in response to kristein)Thanks for your reply SergeySmirnov,
You are right,ProposedPrice and ProposedGrossMargin are input fields and
ProposedGrossMargin is calculated based on ProposedPrice for the particular row of that column.My requirement is once the user enters the price in ProposedPrice field the ProposedGrossMargin shoud be calculated immeadiately for that row.
ProposedGrossMargin= (ProposedPrice-SalesCost)/ProposedPrice
where Sales Cost is also one of the column.
I am new to ajax4jsf and having problem in understanding this.
Please help me how to do this using ajax4jsf with a piece of code.
thanks and regardsd
Kristien -
7. Re: Ajax4jsf and dataTable question
sergeysmirnov Apr 4, 2007 3:50 PM (in response to kristein)I am still confused with one detail.
So, if
ProposedGrossMargin= (ProposedPrice-SalesCost)/ProposedPrice
why ProposedGrossMargin is still a writable field. Does user are able to correct ProposedGrossMargin because she does not trust to formula ? -
8. Re: Ajax4jsf and dataTable question
kristein Apr 4, 2007 3:59 PM (in response to kristein)once again thanks for your kind reply SergeySmirnov,
I got the requirement like that.
Ok, I will make the ProposedGrossmargin field as outputText field.
please.. can you help me how to do this. -
9. Re: Ajax4jsf and dataTable question
sergeysmirnov Apr 4, 2007 4:10 PM (in response to kristein)I will try to do it today.
-
10. Re: Ajax4jsf and dataTable question
kristein Apr 4, 2007 4:12 PM (in response to kristein)Thank you very very much friend.
-
11. Re: Ajax4jsf and datatable question
sergeysmirnov Apr 5, 2007 3:16 AM (in response to kristein)This is an example that uses rich:dataTable
http://livedemo.exadel.com/richfaces-art-dataTable/pages/example10.jsf<h:form id="form"> <rich:dataTable value="#{salesReport.items}" var="item"> <f:facet name="header"> <rich:columnGroup> <h:column> <h:outputText value="Product Code" /> </h:column> <h:column> <h:outputText value="Proposed Price" /> </h:column> <h:column> <h:outputText value="Sales Cost" /> </h:column> <h:column> <h:outputText value="Proposed Gross Margin" /> </h:column> </rich:columnGroup> </f:facet> <h:column> <h:outputText value="#{item.productCode}" /> </h:column> <h:column> <h:inputText value="#{item.proposedPrice}" size="7"> <a4j:support event="onchange" reRender="margin" /> </h:inputText> </h:column> <h:column> <h:outputText value="#{item.salesCost}" /> </h:column> <h:column> <h:outputText id="margin" value="#{item.proposedGrossMargin}"> <f:convertNumber pattern="$###0.000" /> </h:outputText> </h:column> </rich:dataTable> <a4j:outputPanel id="err" ajaxRendered="true"> <h:messages /> </a4j:outputPanel> </h:form>
-
12. Re: Ajax4jsf and dataTable question
kristein Apr 5, 2007 10:30 AM (in response to kristein)Many thanks for your reply SergeySmirnov,
This is what exactly I needed.But now I've few question to ask you.
1)Can I do this without using rich:dataTable.If I should use rich:dataTable then simply Copy the "richfaces-3.0.x.jar" file into the "WEB-INF/lib" folder of my application and add
<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%> on each jsp page.
2)When I change ProposedPrice field value, the ProposedPrice value have to be saved in the DTO at the same time so that it should also shown on some other page.How to update the DTO onchange for the particular row of that column.
3)Where can I get the source code for the example you mentioned above.
I am asking you somuch,sorry I don't have any other source.
Please help me in solving this
once again thanks for your kind help.
thanks and regards
kristein -
13. Re: Ajax4jsf and dataTable question
sergeysmirnov Apr 5, 2007 1:04 PM (in response to kristein)There is no different between rich:dataTable and a4j:repeat, but just a formating. You need to take care about it by yourself.
<a4j:repeat value="#{salesReport.items}" var="item"> <h:inputText value="#{item.proposedPrice}" size="7"> <a4j:support event="onchange" reRender="margin" /> </h:inputText> <h:outputText id="margin" value="#{item.proposedGrossMargin}"> <f:convertNumber pattern="$###0.000" /> </h:outputText> <f:verbatim><br /></f:verbatim> </a4j:repeat>
-
14. Re: Ajax4jsf and dataTable question
kristein Apr 5, 2007 1:37 PM (in response to kristein)Thanks for reply,
When I change ProposedPrice field value, the ProposedPrice value have to be saved in the DTO at the same time so that it should also shown on some other page.How to update the DTO, onchange for the particular row of that column.
thanks and regards
kristein