Getting the index of a selected item from a polymer core-list -


i'm trying scroll simple core-list keyboard key.
core-list:

post-list.html

<core-list data="{{posts}}" selectionenabled="true" selection="{{selectedpost}}" on-core-select="{{selectedhandler}}" fit >     <template repeat>         <post-card post="{{model}}" index="{{index}}" ></post-card>          </template> 

i need index of selected post-card, increment , pass selectitem , scrolltoitem methods of core-list.

the problem i'm facing is... how index?
searched easy way both in core-list , in core-selection without success.

unfortunately core-list attribute "selection" core-list data of current selected record (so can't index attribute it).

am missing something? there solution doesn't involve handling index directly in post-card component?

thanks.

core-list item core-selection handling selection event. try use core-select event index of selected item. this

selectedhandler: function(e, detail, sender) {      var i=this.$.selection.indexof(detail.item);      this.scrolltoitem(i+1);    } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -