行选择对我不起作用。仅当我一次选择所有内容时, selectedItems 数组才会更改。我不确定我是否做错了什么,或者这是一个错误。
selectedItems:包含所选项目的数组。 https://www.webcomponents.org/element/vaadin/vaadin-grid/elements/vaadin-grid
<link rel="import" href="../bower_components/polymer/polymer-element.html">
<link rel="import" href="../bower_components/vaadin-grid/vaadin-grid.html">
<link rel="import" href="../bower_components/vaadin-grid/vaadin-grid-selection-column.html">
<dom-module id="schedule-vaadin-test">
<template>
<vaadin-grid id="material" aria-label="Array Data Example" items="[[items]]" selected-items="{{selectedItems}}">
<vaadin-grid-selection-column auto-select>
</vaadin-grid-selection-column>
<vaadin-grid-column width="50px" flex-grow="0">
<template class="header">#</template>
<template>[[index]]</template>
</vaadin-grid-column>
<vaadin-grid-column>
<template class="header">First Name</template>
<template>[[item.firstName]]</template>
</vaadin-grid-column>
<vaadin-grid-column>
<template class="header">Last Name</template>
<template>[[item.lastName]]</template>
</vaadin-grid-column>
</vaadin-grid>
</template>
<script>
/**
* @customElement
* @polymer
*/
class ScheduleVaadinTest extends Polymer.Element {
static get is() {
return 'schedule-vaadin-test';
}
static get properties() {
return {
items: {
type: Array,
value: [{"firstName":"Foo", "lastName":"Bar"},
{"firstName":"Foo", "lastName":"Bar"},
{"firstName":"Foo", "lastName":"Bar"}]
},
selectedItems: {
type: Array,
observer: 'selectedItemsChanged'
}
};
}
static get observers() {
return []
}
selectedItemsChanged() {
console.log(this.selectedItems);
}
}
customElements.define(ScheduleVaadinTest.is, ScheduleVaadinTest);
</script>
</dom-module>