Polymer access elements within vaadin-grid

Working jsbin illustrating the problem: http://jsbin.com/nomewa/3/edit?html,console,output

I am trying to set the innerHTML of notworking span inside of a template that makes up the vaadin-grid. It does not currently seems to be possible to bind to on-change of vaadin-checkbox when said vaadin-checkbox lies within vaadin-grid since I cannot even access the element within the grid.

1 answer

  • answered 2018-01-10 12:29 HakanC

    This is a great way to try some codes (jsbin :) Here this code works but I do not know is it going to fit your need. (I cut and copied only changed parts : At the property declaration, you may set a pre-value to notWorking property. Then you may change it with dynamically in a function.

    <iron-ajax url="https://randomuser.me/api?results=10" last-response="{{response}}" auto></iron-ajax>
        <span id="working">Working</span>
        <vaadin-grid id="grid" items="{{response.results}}" style="height: auto;">
          <vaadin-grid-column>
            <template class="header">Name</template>
            <template>[[item.name.first]] [[item.name.last]] <span>{{notWorking}}</span></template>
          </vaadin-grid-column>
        </vaadin-grid>
      </template>
      <script>
        class MyTest extends Polymer.Element {
          static get is() { return 'test-component'; }
    
          ready() {
            super.ready();
            this.set('notWorking',"test")
            debugger;
          }
        }
    

    Here the working link