| <html> |
| <head> |
| <title>sort-control-sk demo</title> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> |
| <script src="../../node_modules/native-promise-only/npo.js"></script> |
| <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script> |
| <script src="../common/js/common.js"></script> |
| <script src="../js/gold.js"></script> |
| <script src="testdata.js"></script> |
| |
| <link rel="import" href="bower_components/polymer/polymer.html"> |
| <link rel="import" href="sort-control-sk.html"> |
| <link rel="import" href="bower_components/paper-button/paper-button.html"> |
| |
| </head> |
| <body> |
| <h1>sort-control-sk demo</h1> |
| |
| <dom-module id="main-document-element"> |
| <template> |
| Event: "{{_eventDetail}}" <br> |
| Data: "{{_toJSON(_selection)}}" |
| |
| <br> |
| <br> |
| <sort-control-sk id="sortControls" selection="{{_selection}}" disabled="[[_disabled]]"></sort-control-sk> |
| </template> |
| <script> |
| HTMLImports.whenReady(function () { |
| Polymer({ |
| is: 'main-document-element', |
| |
| properties: { |
| _selection: { |
| type: Object |
| }, |
| |
| _eventDetail: { |
| type: String, |
| value: '' |
| } |
| }, |
| |
| ready: function() { |
| var menuItems = [ |
| {field: "field_1", label: "Long field name"}, |
| {field: "field_2", label: "Short"}, |
| {field: "field_2", label: "Even longer field name"}, |
| ]; |
| this.set('_selection', { dir: gold.SORT_ASC, field:"field_2"}); |
| this.$.sortControls.setItems(menuItems); |
| this.listen(this.$.sortControls, 'sort-changed', '_handleSortChanged'); |
| }, |
| |
| _handleSortChanged: function(ev) { |
| this.set("_eventDetail", JSON.stringify(ev.detail)); |
| }, |
| |
| _toJSON: function(obj) { |
| return JSON.stringify(obj); |
| } |
| }); |
| }); |
| </script> |
| </dom-module> |
| |
| <!-- Instantite the element defined above --> |
| <main-document-element></main-document-element> |
| |
| </body> |
| </html> |