Mithun
Mithun

Reputation: 8067

h:inputText, h:selectOneMenu shows old values after re-rendering

I have h:inputText, h:selectOneMenu in every row in a table. I also have delete button at the end of each row. On-click of delete button corresponding row is deleted. When I delete a row, number of rows displayed in the table is reduced by one but the data is still displayed from old row. Condider the following example:

Consider I have three rows:

Text1 comboxBox1 delete1
Text2 comboxBox2 delete2
Text3 comboxBox3 delete3

on-click of delete1:

Current behaviour
Text1 comboxBox1 delete2
Text3 comboxBox3 delete3

Expected behaviour
Text2 comboxBox2 delete2
Text3 comboxBox3 delete3

One weird thing that I observed is that, when I changed inputText to outputText the data is getting refreshed. I am facing this problem only with input components (textArea, testBox, combo-box and check-box).

I am using JSF1.2, Spring web-flow in portal environment.

Upvotes: 0

Views: 1122

Answers (1)

BalusC
BalusC

Reputation: 1108642

So, only the submitted value of the input component is been shown instead of the model value. This suggests that validation has failed on the particular component. How exactly are you invoking the delete button? I have the impression that you're suppressing validation errors and removing the row inside a non-action method.

This is not the proper way of deleting a datatable's row. All you need is an immediate="true" on the delete button (and ensure that you don't have this attribute on the input components of the same row!).

Upvotes: 1

Related Questions