Your search did not match any results.


The Accordion widget contains several panels displayed one under another. These panels can be collapsed or expanded by a user, which makes this widget very useful for presenting information in a limited amount of space.
Copy to Codepen
window.onload = function() { var viewModel = function(){ var that = this; that.animationDuration = ko.observable(300); that.collapsible = ko.observable(false); that.multiple = ko.observable(false); that.selectedItems = ko.observableArray([accordionItems[0]]); that.accordionOptions = { dataSource: accordionItems, itemTemplate: "customer", animationDuration: that.animationDuration, collapsible: that.collapsible, multiple: that.multiple, selectedItems: that.selectedItems }; that.tagBoxOptions = { dataSource: accordionItems, displayExpr: "CompanyName", value: that.selectedItems, disabled: ko.computed( function(){ return !that.multiple(); }) }; }; ko.applyBindings(new viewModel(), document.getElementById("accordion")); };
<!DOCTYPE html> <html xmlns=""> <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> <script src=""></script> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="dx-theme" data-theme="generic.light" href="" /> <script src=""></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"> <div id="accordion"> <div data-bind="dxAccordion: accordionOptions"> <div data-options="dxTemplate : { name: 'title' } "> <h1 data-bind="text: $data.CompanyName"></h1> </div> <div data-options="dxTemplate : { name: 'customer' } "> <div class="accodion-item"> <div> <p> <b data-bind="text: $data.City"></b> (<span data-bind="text: $data.State"></span>) </p> <p> <span data-bind="text: $data.Zipcode"></span> <span data-bind="text: $data.Address"></span> </p> </div> <div> <p> Phone: <b data-bind="text: $data.Phone"></b> </p> <p> Fax: <b data-bind="text: $data.Fax"></b> </p> <p> Website: <a target="_blank" data-bind=" attr: { href: $data.Website }, text: $data.Website" ></a> </p> </div> </div> </div> </div> <div class="dx-fieldset options"> <div class="dx-field"> <div data-bind="dxCheckBox: { value: multiple, text: 'Multiple enabled' }"></div> <div data-bind="dxCheckBox: { value: collapsible, text: 'Collapsible enabled' }"></div> </div> <div class="dx-field"> <div class="dx-field-label">Animation duration</div> <div class="dx-field-value"> <div data-bind="dxSlider: { min:0, max:1000, value: animationDuration, label: { visible: true}, tooltip: { enabled: true, position: 'bottom' } }"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Selected Items</div> <div class="dx-field-value"> <div data-bind="dxTagBox: tagBoxOptions"></div> </div> </div> </div> </div> </div> </body> </html>
.options { padding-top: 30px; } .options .dx-checkbox { margin-right: 15px; } #accordion h1 { font-size:20px; }
var accordionItems = [{ "ID": 1, "CompanyName": "Super Mart of the West", "Address": "702 SW 8th Street", "City": "Bentonville", "State": "Arkansas", "Zipcode": 72716, "Phone": "(800) 555-2797", "Fax": "(800) 555-2171", "Website": "" }, { "ID": 2, "CompanyName": "Electronics Depot", "Address": "2455 Paces Ferry Road NW", "City": "Atlanta", "State": "Georgia", "Zipcode": 30339, "Phone": "(800) 595-3232", "Fax": "(800) 595-3231", "Website": "" }, { "ID": 3, "CompanyName": "K&S Music", "Address": "1000 Nicllet Mall", "City": "Minneapolis", "State": "Minnesota", "Zipcode": 55403, "Phone": "(612) 304-6073", "Fax": "(612) 304-6074", "Website": "" }, { "ID": 4, "CompanyName": "Tom's Club", "Address": "999 Lake Drive", "City": "Issaquah", "State": "Washington", "Zipcode": 98027, "Phone": "(800) 955-2292", "Fax": "(800) 955-2293", "Website": "" }];