Asked By: Anonymous
I have paper-tabs like this
<paper-dialog id="view"> _x000D_
<paper-tabs selected="0">_x000D_
<paper-tab on-tap="_changeList">TAB 1</paper-tab>_x000D_
<paper-tab on-tap="_changeList">TAB 2</paper-tab>_x000D_
<paper-tab on-tap="_changeList">TAB 3</paper-tab>_x000D_
</paper-tabs>_x000D_
<iron-list>some story for tab 1</iron-list>_x000D_
<iron-list>some story for tab 2</iron-list>_x000D_
<iron-list>some story for tab 3</iron-list>_x000D_
</paper-dialog>
_x000D_
_x000D_
x000D
and i have different iron-list for each tab. First tab will be select but as user will click on other tab so content should be change for selected tab. _changeList function will be bring different data .How can i achieve this ? Please
Solution
Answered By: Anonymous
By binding paper-tabs
‘s selected
propertry with iron-pages
‘s selected
property will show the corresopnding based on selected tab.
<paper-dialog id="view">
<paper-tabs selected="{{currentPage}}">
<paper-tab on-tap="_changeList">TAB 1</paper-tab>
<paper-tab on-tap="_changeList">TAB 2</paper-tab>
<paper-tab on-tap="_changeList">TAB 3</paper-tab>
</paper-tabs>
<iron-pages selected="{{currentPage}}">
<iron-list>some story for tab 1</iron-list>
<iron-list>some story for tab 2</iron-list>
<iron-list>some story for tab 3</iron-list>
</iron-pages>
</paper-dialog>
As you want to show the first tab by defalut, you need to set the currentPage
value to 0
ready: function(){
this.currentPage = 0;
}
Hope this helps 🙂