2016-03-23 6 views
1

私はマスター/ディテールのシナリオを持っています。私はpaper-datatable by David Mulderを私のユーザーリストに使用しています。データはfirebaseコレクション によって読み込まれます。行をタップすると、選択したユーザーの詳細が表示された用紙ダイアログが表示されます。 フィールドを編集しようとすると、firebaseでの更新は1回のキーストローク後に停止します。firebase-collection:入力値は最初のキーストロークのみを更新します

私には何が欠けていますか?

<dom-module id="user-list"> 
    <template> 
     <style> 
     :host { 
      @apply(--layout-vertical); 
     } 

     #editDialog { 
      min-width: 500px; 
     } 
     </style> 
     <firebase-collection location="https://<FIREBASE_APP>.firebaseio.com/users" data="{{users}}"></firebase-collection> 

     <paper-dialog id="editDialog" entry-animation="scale-up-animation" exit-animation="fade-out-animation" with-backdrop> 
      <div> 
       <paper-input value="{{selectedUser.name}}" label="Name" class="flex"></paper-input> 
       <paper-input value="{{selectedUser.username}}" label="Username" class="flex"></paper-input> 
      </div> 
      <div class="buttons"> 
       <paper-button dialog-confirm autofocus>Ok</paper-button> 
      </div> 
     </paper-dialog> 

     <paper-datatable id="datatable" selected-item="{{selectedUser}}" selectable on-row-tap="_onDetail" data="{{users}}"> 
      <div no-results> 
       Loading or no more items... 
      </div> 
      <paper-datatable-column header="Name" property="name" type="String" sortable style="min-width: 160px"></paper-datatable-column> 
      <paper-datatable-column header="Username" property="username" type="String" sortable style="min-width: 40px"></paper-datatable-column> 
     </paper-datatable> 
    </template> 
    <script> 
    Polymer({ 
     is: 'user-list', 

     behaviors: [ 
      Polymer.NeonAnimatableBehavior 
     ], 

     properties: { 
      type: String, 
      selectedUser: { 
       type: Object, 
       notify: true 
      }, 
      users: { 
       type: Array, 
       notify: true 
      }, 
      animationConfig: { 
       value: function() { 
        return { 
         'entry': { 
          name: 'fade-in-animation', 
          node: this 
         }, 
         'exit': { 
          name: 'fade-out-animation', 
          node: this 
         } 
        } 
       } 
      } 
     }, 

     _onDetail: function() { 
      var dialog = document.getElementById('editDialog'); 
      if (dialog) { 
       dialog.open(); 
      } 

     } 
    }) 
    </script> 
</dom-module> 

答えて

1

配列のような構造でのデータとFirebase場所へのビューの多くはで、firebase-collectionは、現在このような方法で使用されるものではないようです。ただし、新規アイテムの追加/削除は可能ですが、既存アイテムの更新はできません。 https://elements.polymer-project.org/elements/firebase-element?active=firebase-collectionを参照してください。

つまり、コレクションの各アイテムにはfireベースでそのアイテムを直接更新するために使用できる__firebaseKey__プロパティがあります。

関連する問題