Wednesday, 15 April 2015

polymer - Manipulating displayed value and committedValue on core-input -


To manipulate values ​​from raw API data for user performance and send them updates via API again Need to manipulate I am using Core-Input for each value, but I'm having difficulty setting the initial value and forcing it to correct update events.

  & lt; Input id = "host" = "core-input" & gt;  

My first problem is that I do not know how to set and manipulate the initial value without having to live stream can be bound. I tried to force only on committedValue but this field does not set the initial value.

However, when I set up commitedValue , I'm unable to trigger it, I enter text in the field and then switch the field or press enter and Nothing happens.

  & lt; Input id = "host" commitedValue = "{{record | setHost}}" = "core-input" & gt;  

and javascript:

  setHost: {toDOM: function (record) {if (record.host === "@") {return records. Domain; } And {return record.host + "." + Record.domain; }}, ToModel: function (value) {if (record.host === "@") {record record.domain; } And {return record.host + "." + Record.domain; }}}}  

To set the initial value, I think that you - Time binding.

  & lt; Template = "auto binding" & gt; & Lt; Input = "core-input" type = "text" value = "[[foo]]" & gt; & Lt; / Template & gt; & Lt; Script & gt; Var tmpl = document.query selector ('template'); Tmpl.foo = 'Bar'; & Lt; / Script & gt;  

It seems that the way you are trying to get with commitedValue can not be supported, because you are actually commitedValue .

Installing this property has no effect on the input value.

This On-Change or On-Blur (or both), handle the change, and then manually < Code> value

/ html>

No comments:

Post a Comment