Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with polymer 1.0 dom-repeat templates using paper-radio-group and the selected property #1792

Closed
ghawkins-pulsemining opened this issue Jun 8, 2015 · 2 comments
Assignees
Labels

Comments

@ghawkins-pulsemining
Copy link

Hi,
I am having issues in polymer 1.0 with the paper radio group, specifically when using the selected attribute, but only when the paper-radio-buttons contained within are in a dom-repeat template.

Also note that If any dom-repeat template breaks, all break paper-radio-group dom-repeat templates break.
i.e if second group below is commented out, the first one works, if it is included, both the first and second templated groups break. Selected attribute always works on non-templated radio buttons in the group.

<p>works</p>
<paper-radio-group>
  <template is="dom-repeat" items="{{sizes}}">
    <paper-radio-button name="{{item.name}}" >{{item.name}}</paper-radio-button>
  </template>
</paper-radio-group>

<p>Doesn't work</p>
<paper-radio-group selected="Large">
  <template is="dom-repeat" items="{{sizes}}">
    <paper-radio-button name="{{item.name}}" >{{item.name}}</paper-radio-button>
  </template>
</paper-radio-group>

<p>works</p>
<paper-radio-group>
  <paper-radio-button name="Small" >Small</paper-radio-button>
  <paper-radio-button name="Medium" >Medium</paper-radio-button>
  <paper-radio-button name="Large" >Large</paper-radio-button>
</paper-radio-group>

<p>works</p>
<paper-radio-group selected="Large">
  <paper-radio-button name="Small" >Small</paper-radio-button>
  <paper-radio-button name="Medium" >Medium</paper-radio-button>
  <paper-radio-button name="Large" >Large</paper-radio-button>
</paper-radio-group>

and defining the equivalent sizes array in ready:

ready: function() {
this.sizes = [{name:'Small'},{name:'Medium'},{name:'Large'}];
}

On a side note also, i am trying to set vertical layout to the buttons (), which i can do using the @apply(--layout-vertical); style, however alignment is forced in flex-direction: column. Only way i can get it to align correctly with the radio buttons with their labels is to force flex-direction: row using !important. Is there a good way of toggling vertical alignment with labels aligned with the radio buttons?

paper-radio-button[vertical="true"] { @apply(--layout-vertical); flex-direction: row !important; }

Many thanks,
Grant.

(i originally logged this issue under PolymerElements/paper-radio-group#8 (comment) but am guessing it is more of an issue with dom-repeat templates)

@kevinpschaaf
Copy link
Member

@notwaldorf After PolymerElements/paper-radio-group#8 (comment) is resolved, can you close this issue or add more information & re-assign to me? Thanks.

@notwaldorf
Copy link
Contributor

I think this was a problem with the borked implementation of paper-radio-group, and everything looks fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants