Skip to content

Implements attr-for-selected, selected-attr, and selected-item#66

Open
bennypowers wants to merge 6 commits intoFabricElements:masterfrom
bennypowers:master
Open

Implements attr-for-selected, selected-attr, and selected-item#66
bennypowers wants to merge 6 commits intoFabricElements:masterfrom
bennypowers:master

Conversation

@bennypowers
Copy link
Copy Markdown

Does what it says on the box.
also fixes a typo

@ernysans ernysans requested a review from stivaliserna March 7, 2018 13:45
* @param {Event} event Polymer change event
*/
onSelectedItemChanged(event) {
this._setSelectedItem(event.detail.value);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bennypowers

What is this for?

_setSelectedItem is being set on _selectedObserver already.

Copy link
Copy Markdown
Author

@bennypowers bennypowers Mar 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to set it based off the iron-selector's selectedItem prop, than to create our own with bracket syntax.
In general I prefer smaller single-purpose methods, rather than do-it-all observers. I'll make a commit which removes the call to _setSelectedItem in _selectedObserver, or if you like I can remove the listener and change the call in _selectedObserver to _setSelectedItem(this.$.selector.selectedItem)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove the listener and change the call in _selectedObserver to _setSelectedItem(this.$.selector.selectedItem)

That sounds reasonable, but I was trying to use attr-for-selected and it didn't work, many pieces of this component depend on numerical index values right now, so a lot of work is required.

If you want to give it a shot I think the first step is to replace _children and all its related logic with iron-selector's items.

Copy link
Copy Markdown
Author

@bennypowers bennypowers Mar 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the way forward is to use Polymer.IronSelectableBehavior instead of instantiating <iron-selector> in the template. I'll get working on it in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants