-
1. Re: Errai databinding - nested binding
ddadlani Sep 3, 2014 12:16 PM (in response to slavap)Hello Slava,
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?Regards,
Divya -
2. Re: Errai databinding - nested binding
slavap Sep 3, 2014 2:43 PM (in response to ddadlani)I've already shown example in my previous post. What exactly is not clear?
-
3. Re: Errai databinding - nested binding
ddadlani Sep 3, 2014 4:43 PM (in response to slavap)Hello,
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?Divya.
-
4. Re: Errai databinding - nested binding
slavap Sep 3, 2014 9:04 PM (in response to ddadlani)Hi,
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
model.setChild(newChild);
assertEquals("Widget not properly updated", "new string", textBox.getText());
-
5. Re: Errai databinding - nested binding
ddadlani Sep 4, 2014 11:08 AM (in response to slavap)Hello Slava,
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?
Regards,
Divya
-
6. Re: Errai databinding - nested binding
slavap Sep 4, 2014 3:06 PM (in response to ddadlani)Hello,
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.