Monday, February 25, 2013

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

By the way I found out, that using nameCell.setValue("value change name", true); together with clearing the viewData will not change the visible label in front of the EditTextCell, but when I change the cell to edit mode by clicking on it, then the text is NOT equal to the label, but just shows the value that was used in cell.setValue().

Thus probably a bug in the rendering of the label, not in the viewdata?


2013/2/25 Kody <kodyrecords@gmail.com>
Hm ok I tried this, but it does not change the issue I described above. Though clearing the viewdata, only the first edit is overridden.


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