Monday, February 25, 2013

Re: ValueChangeHandler on EditTextCell does only work for 1st edit?

Thanks that's a good hint. But using as you suggested only fixes the behaviour for every 2nd data change.

Thats really strange: I edit the field 1st time, then value is overriden. I edit it 2nd time: value stays as has been input. I edit 3rd time: value is overridden again. And so forth.
Why every 2nd time? That makes no sense to me...


2013/2/25 Thomas Broyer <t.broyer@gmail.com>
Editable cells keep their current state in their "view data"; if you want to set the value programmatically you have to clearViewData() first.

Try adding something like:
((AbstractEditableCell<String>) nameCell.getCell()).clearViewData(nameCell.getValue());
before you setValue().

Still trying to determine whether it's a bug in CellWidget or just something you have to deal with yourself…

On Monday, February 25, 2013 10:29:58 AM UTC+1, membersound wrote:
Hi,

I have a big problem with ValueChangeEvent on an EditTextCell: for testing purpose, I just always set the value to a fixed string, no matter what the change event was.

Result: the first time I change the text in EditTextCell it works as expected and overrides the input text.
BUT any other time I then change is, it does NOT! I keeps the newly entered text, even though it should be overriden.


@UiField(provided = true)
CellWidget<String> nameCell = new CellWidget<String>(new EditTextCell());


nameBox.addValueChangeHandler(new ValueChangeHandler<String>() {
           
    @Override
    public void onValueChange(ValueChangeEvent<String> event) {
        nameCell.setValue("value change name");
        //nameCell.setValue("value change name", false, true); //also tried these both, but same behaviour
        //nameCell.setValue("value change name", true, true);
    }
});



Can anyone spot a failure in my code?

--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/Yo_NkiaBl7A/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsubscribe@googlegroups.com.

To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment