Your search did not match any results.
Radio Group

Overview

Documentation
The RadioGroup is a widget that contains a set of radio buttons and allows an end user to make a single selection from the set. This demo illustrates how to change the widget layout, define a custom template and handle the value change event.
Copy to Codepen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { $scope.list = [tasks[1]]; $scope.radioGroup = { simple: { items: priorities, value: priorities[0] }, disabled: { items: priorities, value: priorities[1], disabled: true }, changeLayout: { items: priorities, value: priorities[0], layout: "horizontal" }, customItemTemplate: { items: priorities, value: priorities[2], itemTemplate: function(itemData, _, itemElement){ itemElement .parent().addClass(itemData.toLowerCase()) .text(itemData); } }, eventRadioGroupOptions: { items: priorities, value: priorities[0], onValueChanged: function(e) { $scope.list = tasks.filter(function(item) { return priorities[item.priorityIndex] == e.value; }); } } }; });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="js/jquery-3.1.0.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.3/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.3/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/17.1.3/css/dx.light.css" /> <link rel="dx-theme" data-theme="android5.light" href="https://cdn3.devexpress.com/jslib/17.1.3/css/dx.android5.light.css" /> <link rel="dx-theme" data-theme="ios7.default" href="https://cdn3.devexpress.com/jslib/17.1.3/css/dx.ios7.default.css" /> <link rel="dx-theme" data-theme="win10.black" href="https://cdn3.devexpress.com/jslib/17.1.3/css/dx.win10.black.css" /> <link rel="dx-theme" data-theme="win10.white" href="https://cdn3.devexpress.com/jslib/17.1.3/css/dx.win10.white.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C\/script%3E'))</script> <script src="https://cdn3.devexpress.com/jslib/17.1.3/js/dx.all.js"></script> <script src="data.js"></script> <link rel="stylesheet" type ="text/css" href ="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div class="form"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Default mode</div> <div class="dx-field-value"> <div dx-radio-group="radioGroup.simple"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> <div dx-radio-group="radioGroup.disabled"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Horizontal layout</div> <div class="dx-field-value"> <div dx-radio-group="radioGroup.changeLayout"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Custom item template</div> <div class="dx-field-value"> <div dx-radio-group="radioGroup.customItemTemplate"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Event handling</div> <div class="dx-field-value"> <div id="radio-group-with-selection" dx-radio-group="radioGroup.eventRadioGroupOptions"></div> </div> </div> </div> <div id="tasks-list"> Tasks by selected priority: <ul ng-repeat="task in list" id="list"> <li>{{task.subject}}</li> </ul> </div> </div> </div> </body> </html>
.low.dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: gray; } .normal.dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: green; } .urgent.dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: orange; } .high.dx-radiobutton-checked .dx-radiobutton-icon .dx-radiobutton-icon-dot { background: red; } #radio-group-with-selection { margin-bottom: 10px; } #tasks-list { margin: 0 0 10px 10px; white-space: normal; } #list { margin: 10px 0 0 20px; padding-left: 0; text-align: left; }
var priorities = ["Low", "Normal", "Urgent", "High"]; var tasks = [{ id: 1, subject: "Choose between PPO and HMO Health Plan", assignedEmployeeId: 1, priorityIndex: 3 }, { id: 2, subject: "Non-Compete Agreements", assignedEmployeeId: 2, priorityIndex: 0 }, { id: 3, subject: "Comment on Revenue Projections", assignedEmployeeId: 2, priorityIndex: 1 }, { id: 4, subject: "Sign Updated NDA", assignedEmployeeId: 3, priorityIndex: 2 }, { id: 5, subject: "Submit Questions Regarding New NDA", assignedEmployeeId: 6, priorityIndex: 3 }, { id: 6, subject: "Rollout of New Website and Marketing Brochures", assignedEmployeeId: 22, priorityIndex: 3 }];