| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 2 | "http://www.w3.org/TR/html4/loose.dtd"> |
| 3 | <html dir="ltr"> |
| 4 | <head> |
| 5 | <title>Test Nested sorting 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 | } |
| 17 | #grid { |
| 18 | width: 85.2em; |
| 19 | height: 50em; |
| 20 | } |
| 21 | </style> |
| 22 | <script type="text/javascript" src="../../../../dojo/dojo.js" |
| 23 | data-dojo-config="isDebug:true, parseOnLoad: true"></script> |
| 24 | <script type="text/javascript" src="../../../../dijit/tests/_testCommon.js"></script> |
| 25 | <script type="text/javascript"> |
| 26 | dojo.require("dojox.grid.EnhancedGrid"); |
| 27 | dojo.require("dojox.grid.enhanced.plugins.NestedSorting"); |
| 28 | dojo.require("dojo.data.ItemFileWriteStore"); |
| 29 | dojo.require("dojo.parser"); |
| 30 | </script> |
| 31 | <script type="text/javascript"> |
| 32 | var layout = [[ |
| 33 | {name: 'Column A', field: 'id'}, |
| 34 | {name: 'Column B', field: 'col2', nosort: true}, |
| 35 | {name: 'Column C', field: 'col3'}, |
| 36 | {name: 'Column D', field: 'col4', width: "150px"}, |
| 37 | {name: 'Column E', field: 'col5'}, |
| 38 | {name: 'Column F', field: 'col6'}, |
| 39 | {name: 'Column G', field: 'col7', width: "150px"}, |
| 40 | {name: 'Column H', field: 'col1', width: "150px"} |
| 41 | ]]; |
| 42 | |
| 43 | dojo.addOnLoad(function(){ |
| 44 | grid = new dojox.grid.EnhancedGrid({ |
| 45 | id: "grid", |
| 46 | store: test_store, |
| 47 | structure: layout, |
| 48 | rowSelector: "20px", |
| 49 | sortFields: [{attribute: 'col4', descending: false},{attribute: 'col7', descending: true}],//default sorting order |
| 50 | canSort: function(colIndex, field){ |
| 51 | return colIndex != 0 && field != 'col6'; |
| 52 | }, |
| 53 | plugins: {nestedSorting: true} |
| 54 | }); |
| 55 | |
| 56 | dojo.byId("gridDiv").appendChild(grid.domNode); |
| 57 | grid.startup(); |
| 58 | }); |
| 59 | |
| 60 | function newSort(){ |
| 61 | var sortFields = [{attribute: 'col3', descending: true},{attribute: 'col1', descending: false}]; |
| 62 | var g = dijit.byId('grid'); |
| 63 | g.setSortIndex(sortFields); |
| 64 | } |
| 65 | </script> |
| 66 | <script type="text/javascript" src="../../tests/support/test_data.js"></script> |
| 67 | </head> |
| 68 | <body class="claro"> |
| 69 | <h1 class="title">dojox.grid.EnhancedGrid - NestedSorting</h1> |
| 70 | <p><h3>Column A, ColumnB Column F are unsortable</h3></p> |
| 71 | <p><div id="gridDiv"></div></p> |
| 72 | <p><h3>Set new sort order as:[Column C(desc), Column H(asc)]:</h3> <input type='button' value='Set new Sorting Order' onclick='newSort()'/></p> |
| 73 | </body> |
| 74 | </html> |