I have a problem with the selection of ds lists in my polymer application. I have a functioning list of chat titles (implemented as deepstream records), which should be used to select the matching chat histories (which are implemented as a deepstream list containing the chat messages as records).
<div class="chatlist">
<!-- This is the list of chats -->
<paper-menu selected="[[chatlist]]">
<paper-item>
<paper-input label="New Chat:" id="chatName" on-keydown="setChatName"></paper-input>
</paper-item>
<template
is="dom-repeat"
items="[[todos]]"
as="recordId">
<div role="listbox">
<chat-names
name="[[recordId]]">
</chat-names>
</div>
</template>
</paper-menu>
</div>
<!-- this is the chat history -->
<iron-pages
selected="[[chatlist]]"
attr-for-selected="chatView"
fallback-selection="chatView404"
role="main">
<template
is="dom-repeat"
items="[[todos]]"
as="recordId">
<chat-view
chatView="[[???]]"
name="[[recordId]]">
</chat-view>
</template>
</iron-pages>
So here is my problem: although the chat-list works fine, I don't know how to connect the selection of the chat itself to the display of the matching chat history.
The creation of the chat title happens in the paper-input on-keydown="setChatName"
function, which looks like this:
setChatName: function (e) {
if (e.which === 13) {
var recordId = 'polymer-example/' + this.ds.getUid();
var todo = this.$$( '.new-record-input' ).value;
var todoRecord = this.ds.record.getRecord( recordId );
var todoList = this.ds.record.getList( this.name );
todoRecord.set( { name: todo, checked: false } )
todoRecord.whenReady( function() {
todoList.addEntry( recordId );
} );
this.$.chatName.value = '';
}
},
How can I now set not only the record of the chat name itself, but also the ds-list that contains the chat history? And: Which attributes of the ds-list are useful (eg. id? name?) to use as an attribute to select it?
Sorry for the long question, every answer is much appreciated!