-
1. Re: problem with DataScroller and h:commandLink (reRender)
moldovan Nov 21, 2007 12:14 PM (in response to raphael.martins)Why are you using <h:commandButton>-Tag? You don't need normal commandButton with aj4:support, use a4j:commandButton.
Try it with <a4j:commandButton action="#{...}" reRender="TableId, ScrollerId">
And for debugging: put a4j:log component into your page -
2. Re: problem with DataScroller and h:commandLink (reRender)
raphael.martins Nov 21, 2007 12:36 PM (in response to raphael.martins)The reason is:
- When I use <a4j:commandButton> and the method doesn't have return the 'rerender' doesn't work. The table should be empty, but It keeps the old content.
- When I use <h:commandButton> with "<a4j:support>", it works. -
3. Re: problem with DataScroller and h:commandLink (reRender)
fmarwede Nov 21, 2007 12:40 PM (in response to raphael.martins)Hmm...give us more infos please. Versions of used libraries and so on.
-
4. Re: problem with DataScroller and h:commandLink (reRender)
raphael.martins Nov 21, 2007 12:48 PM (in response to raphael.martins)Futher, with a4j:commandButton the same problem happens. I have just tested.
The rerender only works in second click.
Thanks. -
5. Re: problem with DataScroller and h:commandLink (reRender)
raphael.martins Nov 21, 2007 12:54 PM (in response to raphael.martins)the versions are:
jsf1.2_04-api.jar
jsf1.2_04-impl.jar
richfaces-api-3.1.2.GA.jar
richfaces-impl-3.1.2.GA.jar
richfaces-ui-3.1.2.GA.jar -
6. Re: problem with DataScroller and h:commandLink (reRender)
fmarwede Nov 21, 2007 12:55 PM (in response to raphael.martins)It would be very helpful a) to know your used versions and b) to look at a minimal code snippet where the problem appears. So we can test your code directly.
-
7. Re: problem with DataScroller and h:commandLink (reRender)
fmarwede Nov 21, 2007 12:56 PM (in response to raphael.martins)Ah sorry, I was to fast. So forget a) of the last post ;-)
-
8. Re: problem with DataScroller and h:commandLink (reRender)
raphael.martins Nov 21, 2007 2:59 PM (in response to raphael.martins)Ok, the code below is a simplification of my problem. (only relevant code)
If you test, you will see that the Scroller just rerenders in the second request.
Jsp<h:form id="myTestForm"> <h:inputText value="#{test.searchContent}" /> <br /> <h:commandButton value="Search" action="#{test.search}"> <a4j:support event="onclick" reRender="myRichDataTable1,myDataScroller1" /> </h:commandButton> <br /> <a4j:outputPanel ajaxRendered="true" id="myAjaxOutputPanel1"> <rich:datascroller ajaxSingle="false" id="myDataScroller1" for="myRichDataTable1" immediate="true" /> <rich:dataTable rows="10" id="myRichDataTable1" var="myLocalList" value="#{test.listNames}"> <f:facet name="header"> <rich:columnGroup id="candidateLocalColumnGroup1"> <rich:column> <h:outputText value="Name" /> </rich:column> </rich:columnGroup> </f:facet> <rich:column> <h:outputText value="#{myLocalList.name}" /> </rich:column> </rich:dataTable> </a4j:outputPanel> </h:form>
ManagedBeanpublic List getListNames() { Collection myTestList = new ArrayList(); if (searchContent != null) { if ( searchContent.equals( "a" ) ) { for ( int i = 0; i < 5; i++ ) { TestDTO testDTO = new TestDTO(); testDTO.setName( "a" + i ); myTestList.add( testDTO ); } } else if ( searchContent.equals( "b" ) ) { for ( int i = 0; i < 15; i++ ) { TestDTO testDTO = new TestDTO(); testDTO.setName( "b" + i ); myTestList.add( testDTO ); } } else if ( searchContent.equals( "c" ) ) { for ( int i = 0; i < 25; i++ ) { TestDTO testDTO = new TestDTO(); testDTO.setName( "c" + i ); myTestList.add( testDTO ); } } else { myTestList = null; } } return (List) myTestList; } public String search() { //some validations getListNames(); //workarround to set DataTable page = 1 return null; }
-
9. Re: problem with DataScroller and h:commandLink (reRender)
ilya_shaikovsky Nov 22, 2007 3:50 AM (in response to raphael.martins)<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="8" rowKeyVar="rowKey" id="table"> <rich:column> <h:outputText value="#{cap.name}"> </h:outputText> </rich:column> <f:facet name="footer"> <rich:datascroller id="scroller"/> </f:facet> </rich:dataTable> <a4j:commandButton value="add capital" action="#{capitalsBean.addEmptyCapital}" reRender="table, scroller"></a4j:commandButton>
This code just worked for me.
B.t.w. I use 3.1.3 SNAPSHOTS.JSF 1.2 and facelets 1.1.14
B.t.w. Again I need to mention.. It's more usefull to understand the usage way before using the framework.
1) You should not use h:command* with support inside. Or you just need in duplicated submits?? But nobody will check the result because the usage is wrong.
2) You have ajaxRendered Panel and use reRender. Isn't a mistake but after such constructions I'll ask you to read docs again. -
10. Re: problem with DataScroller and h:commandLink (reRender)
raphael.martins Nov 22, 2007 8:57 AM (in response to raphael.martins)I understand and I thank you for the post.
The ajaxRendered Panel was used because I was trying to figure out my issue. I know its'nt is 100% correct.
My problem was resolved when I put the datascroller inside the dataTable as a footer. The dataScroller had a tag 'for' with the dataTableID and reRender dind't work. I don't know why yet.
Now, it's ok.
Thanks. -
11. Re: problem with DataScroller and h:commandLink (reRender)
ilya_shaikovsky Nov 22, 2007 9:42 AM (in response to raphael.martins)moved scroller from footer above and below the table. Still works... :/