Closed graeme44 closed 8 years ago
It seems like this is a summary of the proposal: add a selectIndex
method that lets the user select a value by index. How does that sound to you?
@cdata: @graeme44's PR: #88.
@cdata that sounds great to me. I put it all in a PR: #88.
would be nice to get this in master and eventually released! :)
@MeTaNoV this was merged a while back - see #110 (into branch issue-87). I see that hasn't been merged into master yet @bicknellr.
Thanks for the ping; #119 is out to bring this into master.
Firstly, I understand and acknowledge that it is by design that if attr-for-selected is not null then the selected property is no longer the index and becomes the attr-for-selected variable.
Now, I came across this issue when using the paper-tabs element and the attr-for-selected property.
The context:
Where AjaxData would be something like:
I use the dictionary like object in the attr-for-selected as it can then be used in js to do some cool stuff:
Here is where the problem starts, I am using page.js to do client side routing - every time the user selects the page which has the paper-tabs, I would like the tabs to be 'reset' and the first tab to be selected.
One can no longer use
.selected=0
and no knowledge is known of what the attr-for-selected is for the first (dynamically inserted) element.It would be really useful to have a selectIndex(value) function (like the
selectNext()
andselectPrevious()
functions). This function could just use the _indexToValue(index) to get the corresponding value for the given index (so that attr-for-selected will keep.selected
happy). This solves the problem of someone still needing to address an index while using the attr-for-selected property.