开发者

Ajax refreshing datatable fails if it's triggered from the record of the same datatable?

I would like to achieve this :

Inside my datatable, in one of the cell, i can trigger an action that can refresh the datatable itself by clicking on the commandLink.

But what i experienced is :

After triggering the action, everything works as intended, but lacking only in one thing, which is, it doesnt refresh the datatable.


My excerpt goes like this for the link (yes, i know using @all is not a good idea, but this is for the testing purpose):

<p:column>
    <p:commandLink value="Undo"
        process="@all"
        action="#{tInputBean.undoRemoveRecord(rpbDetail)}" 
        update="@all"
        rendered="#{tInputBean.isRemoveRecord(rpbDetail)}"
    />
</p:column>

And i tested further, putting a button outside of the , inside the header facet of the datatable, that does nothing but only to refresh the grid :

<p:commandButton value="Refresh Data" update="gridRPBDetails" />

So the steps have become :

  1. After clicking on the link, the grid doesnt refresh itself.
  2. Clicking on the refresh button actually refreshes the grid, the link vanishes (because of t开发者_StackOverflow社区he rendered attribute), which means, all the phases and the states in my JSF Bean is already correct. Only the refresh view phase fails.

What i would like to achieve is as simple as : clicking on the link, the link itself refreshes and disappears (from the rendered attribute)

It seems to me that from my tests, the conclusion is : any record that can trigger an action and refresh the grid that contains that record will fail in the refreshing phase.

Any ideas to solve this problem ?


Anyway, i want to share the response after clicking on the "Undo" link from firebug :

<?xml version='1.0' encoding='UTF-8'?>
<partial-response><changes><update id="javax.faces.ViewState"><![CDATA[673421645734309925:-3805206326573204566]]></update></changes><extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension></partial-response>

Im using tomcat 7, and these are my dependencies :

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>2.2.1</version>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.0.4-b09</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.0.4-b09</version>
    <scope>compile</scope>
</dependency>

UPDATE :


I realize this post dont have a simple example, and would be hard to test and explain, thus, i made a simple example that i have posted here.

It's ok if the moderator thinks this post should be removed and do that.

Thank you !


Where are you updating the record? Just by typing process and update wont do. Other than that don't use @all. If your data table is already inside a form it wont update in that @all case. Use @this.

I would like to help you but I don't know what are you trying to do at the back end. In order to refresh the data table you need to have an action Listener or action attribute that would handle refresh. Then the other question what is the scope of your bean? If its session scoped then you need to change that to view scope.

Put your code in here and then i can explain it much better.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜