Comments (10)
@ghawkins-pulsemining For displaying buttons veritcally, all you need is to set display:inline-block
:
paper-radio-button {
display: inline-block;
}
from paper-radio-group.
+1 regarding the usage of paper-radio-group
with dom-repeat
. The distributed dom does not appear ready when the index is obtained. If a domReady event still isn't available, perhaps flushing the dom using Polymer.dom.flush()
or adding addl. latency to the async might be needed when selected
is changed.
from paper-radio-group.
I've noticed similar problems when using a dom-repeat
inside a <paper-radio-group>
; it reports an error on the checked attribute for some reason.
from paper-radio-group.
The workaround proposed by @jongeho1 did the trick for us: Have the application wait until the browser event loop returns before setting the 'selected' property.
from paper-radio-group.
I identified another issue with <paper-radio-group>
and dom-repeat
: The paper-radio-button
sets the _selectedIndex to 0 at initialization. At that point of time, nodes[0] is the template. Hence the paper-radio-group
sets the checked attribute on the template instead of the first paper-radio-button
.
Worse, it's now no longer possible to select the first paper-radio-button
because paper-radio-group._selectIndex
checks if the requested new index is the same as the formerly set index.
Deactivating this check works around this issue:
_selectIndex: function(index) {
- if (index == this._selectedIndex)
- return;
+ // Workaround for bug https://github.com/PolymerElements/paper-radio-group/issues/8
+ //if (index == this._selectedIndex)
+ // return;
var nodes = this.items;
from paper-radio-group.
@ghawkins-pulsemining I think the original issue is fixed in the latest release (1.0.2
). Would you mind double checking it's okay on your end? Thanks!
from paper-radio-group.
confirmed this fixed on FF and Chrome, nice job. I can't seem to initially select the first element (I can initially select the 2nd, 3rd, etc.), but quickly testing, so could be something else.
from paper-radio-group.
Yay! I had this, which selects the first item on all the things, so maybe your example is grumpy:
<template is="dom-bind" items="{{sizes}}" id="t">
<paper-radio-group selected="Small">
<template is="dom-repeat" items="{{sizes}}">
<paper-radio-button name="{{item.name}}" >{{item.name}}</paper-radio-button>
</template>
</paper-radio-group>
<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>
<script>
document.getElementById('t').sizes = [{name:'Small'},{name:'Medium'},{name:'Large'}];
</script>
</template>
from paper-radio-group.
selected="1"
seems to work fine, etc. Maybe cause I'm using [[index]]
(not even sure if that's allowed anymore 😮 )
<dom-module id="radio-group">
<style>
</style>
<template>
<paper-radio-group selected="0">
<template is="dom-repeat" items="[[data]]">
<paper-radio-button name="[[index]]">[[item.title]]</paper-radio-button>
</template>
</paper-radio-group>
<iron-ajax auto url="http://jsonplaceholder.typicode.com/posts" handle-as="json" last-response="{{data}}">
</iron-ajax>
</template>
<script>
Polymer({
is: 'radio-group',
properties: {
data: {
type: Array,
notify: true,
observer: 'dataChanged'
}
},
dataChanged: function(data) {
console.log(data);
}
});
</script>
</dom-module>
from paper-radio-group.
Awesome! Closing this! 💃 🎉
from paper-radio-group.
Related Issues (20)
- Padding of the radio buttons is fixed HOT 1
- Focusing from javascript when no selected error HOT 6
- The default value of "attrForSelected" in "paper-radio-group" causes troubles in iron-form.serialize()
- Detected problem with radio-butons disabled
- Paper radio button names that evaluate to false can be deselected without allow-empty-selection HOT 1
- Paper-radio-group disappears after selection when used in angular 2 HOT 1
- paper-radio-button nested in custom element goes unnoticed HOT 1
- Radio groups don't play well with iron-form HOT 2
- paper-radio-group is not multiselectable despite "multi" property HOT 1
- When pressing Esc, TypeError is thrown HOT 2
- Nested radio groups incorrect behavior HOT 1
- paper-radio-group is multiselectable even though multi is not set to true HOT 2
- Iron-radio-group behaviour?
- README and documentation slightly ambiguous due to rendering issue HOT 1
- how to make a radio-group required?
- A "better than the standards" suggestion for API HOT 1
- Checked radio buttons are never unchecked
- Remove unnecessary paper-radio-button dependency.
- paper-radio-group invalid attributes for ADA HOT 1
- paper-radio-group grouping information not available for screen readers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paper-radio-group.