UNPKG

@reactual/handsontable

Version:

Spreadsheet-like data grid editor

141 lines (115 loc) 4.49 kB
<!doctype html> <html> <head> <meta charset='utf-8'> <title>Dropdown cell type - Handsontable</title> <!-- Loading Handsontable (full distribution that includes all dependencies) --> <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/handsontable.css"> <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/pikaday/pikaday.css"> <script data-jsfiddle="common" src="../dist/pikaday/pikaday.js"></script> <script data-jsfiddle="common" src="../dist/moment/moment.js"></script> <script data-jsfiddle="common" src="../dist/numbro/numbro.js"></script> <script data-jsfiddle="common" src="../dist/numbro/languages.js"></script> <script data-jsfiddle="common" src="../dist/handsontable.js"></script> <!-- Loading demo dependencies. They are used here only to enhance the examples on this page --> <link data-jsfiddle="common" rel="stylesheet" media="screen" href="css/samples.css?20140331"> <script src="js/samples.js"></script> <script src="js/highlight/highlight.pack.js"></script> <link rel="stylesheet" media="screen" href="js/highlight/styles/github.css"> <link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css"> <!-- Facebook open graph. Don't copy this to your project :) --> <meta property="og:title" content="Dropdown cell type"> <meta property="og:description" content="This example shows the usage of the Dropdown feature."> <meta property="og:url" content="http://handsontable.com/demo/dropdown.html"> <meta property="og:image" content="http://handsontable.com/demo/image/og-image.png"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="409"> <meta property="og:image:height" content="164"> <link rel="canonical" href="http://handsontable.com/demo/dropdown.html"> <!-- Google Analytics for GitHub Page. Don't copy this to your project :) --> <script src="js/ga.js"></script> <script data-jsfiddle="common"> function getCarData() { return [ ["Nissan", 2009, "black", "black"], ["Nissan", 2006, "blue", "blue"], ["Chrysler", 2004, "yellow", "black"], ["Volvo", 2012, "white", "gray"] ]; } </script> </head> <body> <div class="wrapper"> <div class="wrapper-row"> <div id="global-menu-clone"> <h1><a href="../index.html">Handsontable</a></h1> </div> <div id="container"> <div class="columnLayout"> <div class="rowLayout"> <div class="descLayout"> <div class="pad" data-jsfiddle="example1"> <h2>Dropdown cell type</h2> <p>This example shows the usage of the Dropdown feature.</p> <p>Dropdown is based on <a href="autocomplete.html">Autocomplete</a> cell type. All options used by <code>autocomplete</code> cell type apply to <code>dropdown</code> as well.</p> <p>Internally, cell <code>{type: "dropdown"}</code> is equivalent to cell <code>{type: "autocomplete", strict: true, filter: false}</code>.</p> <p>Therefore you can think of <code>dropdown</code> as a searchable <code>&lt;select&gt;</code>. </p> <div id="example1"></div> <p> <button name="dump" data-dump="#example1" data-instance="hot" title="Prints current data source to Firebug/Chrome Dev Tools">Dump data to console </button> </p> </div> </div> <div class="codeLayout"> <div class="pad"> <div class="jsFiddle"> <button class="jsFiddleLink" data-runfiddle="example1">Edit in jsFiddle</button> </div> <script data-jsfiddle="example1"> var container = document.getElementById('example1'), hot; hot = new Handsontable(container, { data: getCarData(), startRows: 7, startCols: 4, colHeaders: ['Car', 'Year', 'Chassis color', 'Bumper color'], columns: [ {}, {type: 'numeric'}, { type: 'dropdown', source: ['yellow', 'red', 'orange', 'green', 'blue', 'gray', 'black', 'white'] }, { type: 'dropdown', source: ['yellow', 'red', 'orange', 'green', 'blue', 'gray', 'black', 'white'] } ] }); </script> </div> </div> </div> <div class="footer-text"> </div> </div> </div> </div> </div> <div id="outside-links-wrapper"></div> </body> </html>