| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 2 | "http://www.w3.org/TR/html4/loose.dtd"> |
| 3 | <html> |
| 4 | <head> |
| 5 | <title>Test Cookie plugin of dojox.grid.EnhancedGrid</title> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> |
| 7 | <link rel=stylesheet href="support/common.css"/> |
| 8 | <style type="text/css"> |
| 9 | body { |
| 10 | font-size: 0.9em; |
| 11 | font-family: Geneva, Arial, Helvetica, sans-serif; |
| 12 | padding: 0.5em; |
| 13 | } |
| 14 | .title { |
| 15 | text-align:center; |
| 16 | margin:1em; |
| 17 | } |
| 18 | #grid{ |
| 19 | width: 100em; |
| 20 | height: 30em; |
| 21 | } |
| 22 | /*Sample - overwrite default cell style |
| 23 | .claro .dojoxGridCell{ |
| 24 | border-color: transparent #D5CDB5 #D5CDB5 transparent !important; |
| 25 | } |
| 26 | .dj_ie6 .claro .dojoxGridCell{ |
| 27 | border: 1px solid #F1F1F1 !important; |
| 28 | }*/ |
| 29 | </style> |
| 30 | <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true"></script> |
| 31 | <script type="text/javascript" src="../../../../dijit/tests/_testCommon.js"></script> |
| 32 | <script type="text/javascript"> |
| 33 | dojo.require("dojo.parser"); |
| 34 | dojo.require("dojo.data.ItemFileWriteStore"); |
| 35 | dojo.require("dojox.grid.EnhancedGrid"); |
| 36 | dojo.require("dojox.grid.enhanced.plugins.NestedSorting"); |
| 37 | dojo.require("dojox.grid.enhanced.plugins.DnD"); |
| 38 | dojo.require("dojox.grid.enhanced.plugins.Cookie"); |
| 39 | |
| 40 | var layout = [ |
| 41 | {//first view |
| 42 | defaultCell: {editable: true, type: dojox.grid.cells._Widget}, |
| 43 | cells: |
| 44 | [ |
| 45 | { field: "id", width: 4}, |
| 46 | { field: "Genre", width: '5'}, |
| 47 | { field: "Artist", width: '5'}, |
| 48 | { field: "Year", width: '5'}, |
| 49 | { field: "Album", width: '5'} |
| 50 | ] |
| 51 | }, |
| 52 | {//second view |
| 53 | cells: |
| 54 | [ |
| 55 | { field: "Name", width: '17'}, |
| 56 | { field: "Length", width: '6'}, |
| 57 | { field: "Track", width: '6'}, |
| 58 | { field: "Composer", width: '15'} |
| 59 | ] |
| 60 | } |
| 61 | ]; |
| 62 | var plugins = { |
| 63 | cookie: true, |
| 64 | nestedSorting: true, |
| 65 | dnd: true |
| 66 | }; |
| 67 | function enableCookie(key, toEnable){ |
| 68 | console.log(key,toEnable); |
| 69 | dijit.byId("grid").setCookieEnabled(key || toEnable, toEnable); |
| 70 | } |
| 71 | |
| 72 | </script> |
| 73 | <script type="text/javascript" src="support/test_write_store_music.js"></script> |
| 74 | </head> |
| 75 | <body class="claro"> |
| 76 | <h1 class="title">dojox.grid.EnhancedGrid - Cookie</h1> |
| 77 | <div style="margin:10px;"> |
| 78 | <h3>Options to persist preferences when refreshing the page:</h3><br/> |
| 79 | <input type="checkbox" onclick="enableCookie(null, !this.checked)"> Do not persist anything<br /> |
| 80 | <input type="checkbox" onclick="enableCookie('columnWidth',!this.checked)" /> Do not persist column width<br /> |
| 81 | <input type="checkbox" onclick="enableCookie('sortOrder',!this.checked)" /> Do not persist sorting order<br /> |
| 82 | <input type="checkbox" onclick="enableCookie('columnOrder',!this.checked)" /> Do not persist column arrangement<br /> |
| 83 | <input type="checkbox" onclick="(dijit.byId('grid')).layout.setColumnVisibility(1, !this.checked)" /> Hide column with idx = 1<br /> |
| 84 | </div> |
| 85 | <div id="gridContainer"> |
| 86 | <div id="grid" dojoType="dojox.grid.EnhancedGrid" store="test_store[0]" structure="layout" plugins="plugins"></div> |
| 87 | </div><br/> |
| 88 | <p><strong>Note:</strong> To see the tundra theme, just append <b style="color:blue;">?theme=tundra</b> to the URL.</p> |
| 89 | </body> |
| 90 | </html> |