| 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>Scorll Leak</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 | border: 1px solid #333; |
| 19 | width: 80em; |
| 20 | height: 45em; |
| 21 | } |
| 22 | |
| 23 | </style> |
| 24 | <script type="text/javascript" src="../../../../dojo/dojo.js" |
| 25 | data-dojo-config="isDebug:false, parseOnLoad: true"></script> |
| 26 | <script type="text/javascript"> |
| 27 | dojo.require("dijit.dijit"); // optimize: load dijit layer |
| 28 | dojo.require("dojox.grid.EnhancedGrid"); |
| 29 | dojo.require("dojo.data.ItemFileWriteStore"); |
| 30 | dojo.require("dojo.parser"); |
| 31 | dojo.require("dojox.grid.enhanced.plugins.Filter"); |
| 32 | dojo.require("dojox.grid.enhanced.plugins.exporter.CSVWriter"); |
| 33 | dojo.require("dojox.grid.enhanced.plugins.Printer"); |
| 34 | dojo.require("dojox.grid.enhanced.plugins.Cookie"); |
| 35 | dojo.require("dojox.grid.enhanced.plugins.IndirectSelection"); |
| 36 | dojo.require("dojox.grid.enhanced.plugins.NestedSorting"); |
| 37 | dojo.require("dojox.grid.enhanced.plugins.Selector"); |
| 38 | dojo.require("dojox.grid.enhanced.plugins.Menu"); |
| 39 | dojo.require("dojox.grid.enhanced.plugins.DnD"); |
| 40 | dojo.require("dojox.grid.enhanced.plugins.Search"); |
| 41 | dojo.require("dojox.grid.enhanced.plugins.CellMerge"); |
| 42 | dojo.require("dojox.grid.enhanced.plugins.Pagination"); |
| 43 | dojo.require("dojox.grid.enhanced.plugins.GridSource"); |
| 44 | </script> |
| 45 | <script type="text/javascript" src="../support/test_data.js"></script> |
| 46 | <script type="text/javascript"> |
| 47 | //init data |
| 48 | var data = { |
| 49 | identifier: 'id', |
| 50 | label: 'id', |
| 51 | items: [] |
| 52 | }; |
| 53 | var data_list = [ |
| 54 | { col1: "normal", col2: false, col3: "new", col4: 'But are not followed by two hexadecimal', col5: 29.91, col6: 10, col7: false }, |
| 55 | { col1: "important", col2: false, col3: "new", col4: 'Because a % sign always indicates', col5: 9.33, col6: -5, col7: false }, |
| 56 | { col1: "important", col2: false, col3: "read", col4: 'Signs can be selectively', col5: 19.34, col6: 0, col7: true }, |
| 57 | { col1: "note", col2: false, col3: "read", col4: 'However the reserved characters', col5: 15.63, col6: 0, col7: true }, |
| 58 | { col1: "normal", col2: false, col3: "replied", col4: 'It is therefore necessary', col5: 24.22, col6: 5.50, col7: true }, |
| 59 | { col1: "important", col2: false, col3: "replied", col4: 'To problems of corruption by', col5: 9.12, col6: -3, col7: true }, |
| 60 | { col1: "note", col2: false, col3: "replied", col4: 'Which would simply be awkward in', col5: 12.15, col6: -4, col7: false } |
| 61 | ]; |
| 62 | var rows = 500; |
| 63 | for(var i=0, l=data_list.length; i<rows; i++){ |
| 64 | data.items.push(dojo.mixin({ id: i }, data_list[i%l])); |
| 65 | } |
| 66 | |
| 67 | // global var "test_store" |
| 68 | test_store = new dojo.data.ItemFileWriteStore({data: data}); |
| 69 | |
| 70 | |
| 71 | var grid = null, delta = 1000, interval = 6000; |
| 72 | var plugins = { |
| 73 | "nestedSorting": {}, |
| 74 | "indirectSelection": { |
| 75 | headerSelector: true, |
| 76 | name: "Selection", |
| 77 | width:"70px", |
| 78 | styles:"text-align: center;" |
| 79 | }, |
| 80 | "menus": { |
| 81 | headerMenu: "headerMenu", |
| 82 | rowMenu: "rowMenu", |
| 83 | cellMenu: "cellMenu", |
| 84 | selectedRegionMenu: "selectedRegionMenu" |
| 85 | }, |
| 86 | "exporter": {}, |
| 87 | "printer": {}, |
| 88 | "filter": { |
| 89 | closeFilterbarButton: true, |
| 90 | ruleCount: 0 |
| 91 | }, |
| 92 | "cookie": {}, |
| 93 | "selector": {}, |
| 94 | "dnd": { |
| 95 | copyOnly: false |
| 96 | }, |
| 97 | "cellMerge": { |
| 98 | "mergedCells": [ |
| 99 | {row: "3", start: 1, end: 10, major: 3} |
| 100 | ] |
| 101 | }, |
| 102 | // "pagination": |
| 103 | // { |
| 104 | // pageSizes: ["5", "10", "20", "50", "All"], // Array, custom the items per page button |
| 105 | // // itemTitle: "entrys", // String, custom the item' title of description |
| 106 | // description: true, // boolean, custom weather or not the discription will be displayed |
| 107 | // sizeSwitch: true, // boolean, custom weather or not the page size switch will be displayed |
| 108 | // pageStepper: true, // boolean, custom weather or not the page step will be displayed |
| 109 | // gotoButton: true, |
| 110 | // maxPageStep: 10, // Integer, custom how many page step will be displayed |
| 111 | // position: "bottom" // String, custom the position of the paginator bar |
| 112 | // // there're three options: top, bottom, both |
| 113 | // // ,descTemplate: "${1} ${0}" // A template of the current position description. |
| 114 | // }, |
| 115 | "search": {} |
| 116 | }; |
| 117 | var gridArgs = { |
| 118 | }; |
| 119 | var layout = [[ |
| 120 | {name: 'Column 1', field: 'col1'}, |
| 121 | {name: 'Column 2', field: 'col2'}, |
| 122 | {name: 'Column 3', field: 'col3'}, |
| 123 | {name: 'Column 4', field: 'col4', width: "150px"}, |
| 124 | {name: 'Column 5', field: 'col5'}, |
| 125 | {name: 'Column 6', field: 'col6'}, |
| 126 | {name: 'Column 7', field: 'col7'}, |
| 127 | {name: 'Column 8', field: 'col5'} |
| 128 | ]]; |
| 129 | |
| 130 | dojo.addOnLoad(function() { |
| 131 | grid = new dojox.grid.EnhancedGrid(dojo.mixin({ |
| 132 | id: "grid", |
| 133 | store: test_store, |
| 134 | structure: layout, |
| 135 | rowsPerPage: 25, |
| 136 | keepRows: 75, |
| 137 | plugins : plugins |
| 138 | }, gridArgs)); |
| 139 | |
| 140 | dojo.byId("gridContainer").appendChild(grid.domNode); |
| 141 | grid.startup(); |
| 142 | }); |
| 143 | |
| 144 | function scrollGrid() { |
| 145 | setTimeout(function(){ |
| 146 | grid.scrollToRow(50); |
| 147 | setTimeout(function(){ |
| 148 | grid.scrollToRow(100); |
| 149 | setTimeout(function(){ |
| 150 | grid.scrollToRow(300); |
| 151 | setTimeout(function(){ |
| 152 | grid.scrollToRow(400); |
| 153 | setTimeout(function(){ |
| 154 | grid.scrollToRow(0); |
| 155 | }, delta); |
| 156 | }, delta); |
| 157 | }, delta); |
| 158 | }, delta); |
| 159 | }, delta); |
| 160 | } |
| 161 | |
| 162 | function leakTest(){ |
| 163 | scrollGrid(); |
| 164 | setInterval(function(){ |
| 165 | scrollGrid(); |
| 166 | }, interval); |
| 167 | } |
| 168 | </script> |
| 169 | </head> |
| 170 | <body class="claro"> |
| 171 | <div class="heading">dojox.grid.EnhancedGrid Scorll Leak Test</div> |
| 172 | <button id="leakTest" onClick="leakTest();">EnhancedGrid Scorll Leak</button> |
| 173 | <div id="gridContainer"></div> |
| 174 | </body> |
| 175 | </html> |