I am not entirely sure as to how you are trying to use the databinding feature. Are you using a databinder anywhere in your code?
Is there a code sample you could show us to help illustrate your usage?
I've already shown example in my previous post. What exactly is not clear?
I have written a test case to try and reproduce your example. Is this the data binding behaviour you are referring to?
New test case for data binding to check for nested model change · ee72953 · divd/errai · GitHub
As I understand your question, you want newChild.value and textBox in the test case to be automatically synchronized. Is this correct?
Thanks for answer! Your code looks very close to mine, but there is a slight difference, and for some reason it's not working in my case.
Your test should be looking like this:
TextBox textBox = new TextBox();
TestModel model = new TestModel();
DataBinder<TestModel> dataBinder = DataBinder.forModel(model, InitialState.FROM_MODEL);
model = dataBinder.bind(textBox, "child.value").getModel();
textBox.setValue("old string", true);
assertEquals("Model not properly updated", "old string", model.getChild().getValue());
TestModel newChild = new TestModel();
newChild.value = "new string"; // populate values before assignment
assertEquals("Widget not properly updated", "new string", textBox.getText());
The test case as you have described it, with the value change before assignment, passes. See Edited test case for databinding after model change and update. Test cas... · 9a73041 · divd/errai · GitHub
The previous test case that I sent you, however, does not. I have created a bug report for this at [ERRAI-792] Widget not updated if databinder is bound to a new model and the new model's value is changed. - JBoss Issue…
What version of Errai are you using?
I'm using 3.0.2
Really really strange, let me check my code one more time.
Anyway, leave in your test case BOTH versions of this functionality, because your code was proper test as well.