| 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>Performance Test: dojox.grid.DataGrid dojo.data Notification</title> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> |
| 7 | <style type="text/css"> |
| 8 | @import "../../../../dojo/resources/dojo.css"; |
| 9 | @import "../../resources/Grid.css"; |
| 10 | @import "../../resources/tundraGrid.css"; |
| 11 | |
| 12 | .heading { |
| 13 | font-weight: bold; |
| 14 | padding-bottom: 0.25em; |
| 15 | } |
| 16 | </style> |
| 17 | <script type="text/javascript" src="../../../../dojo/dojo.js"></script> |
| 18 | <script type="text/javascript"> |
| 19 | dojo.require("doh.runner"); |
| 20 | dojo.require("dojox.grid.tests.performance._gridPerfFramework"); |
| 21 | dojo.require("dojox.grid.DataGrid"); |
| 22 | |
| 23 | dojo.addOnLoad(function(){ |
| 24 | var p = searchParamsAsObj(true); |
| 25 | var s = getStore(p.rows); |
| 26 | var g = new dojox.grid.DataGrid({ |
| 27 | store: s, |
| 28 | structure: getLayout(p.layout), |
| 29 | rowSelector: p.rowSelector |
| 30 | }, dojo.create("div", null, dojo.body())); |
| 31 | g.startup(); |
| 32 | var cnt = p.rows + 1; |
| 33 | |
| 34 | var cb = function(items){ |
| 35 | console.debug("HAVE ITEMS!", items.length); |
| 36 | doh.register(searchParamsAsObj(true).rows + " rows - change column", |
| 37 | getRLSTests(function(rows, layout, rowSelector, doProfiling, isPerf){ |
| 38 | return function(t){ |
| 39 | if(doProfiling){ |
| 40 | console.profile("changeColumn()"); |
| 41 | } |
| 42 | dojo.forEach(items, function(i){ |
| 43 | s.setValue(i, "col2", !s.getValue(i, "col2")); |
| 44 | }); |
| 45 | if(doProfiling){ |
| 46 | console.profileEnd(); |
| 47 | } |
| 48 | }; |
| 49 | })); |
| 50 | doh.register(searchParamsAsObj(true).rows + " rows - change row", |
| 51 | getRLSTests(function(rows, layout, rowSelector, doProfiling, isPerf){ |
| 52 | return function(t){ |
| 53 | if(doProfiling){ |
| 54 | console.profile("changeRow()"); |
| 55 | } |
| 56 | var i = items[0]; |
| 57 | s.setValue(i, "col1", s.getValue(i, "col1") == "normal" ? "important" : "normal"); |
| 58 | s.setValue(i, "col2", !s.getValue(i, "col2")); |
| 59 | s.setValue(i, "col3", s.getValue(i, "col3") == "new" ? "read" : "new"); |
| 60 | s.setValue(i, "col4", s.getValue(i, "col4") == "hex" ? "But are not followed by two hexadecimal" : "hex"); |
| 61 | s.setValue(i, "col5", -(s.getValue(i, "col5"))); |
| 62 | s.setValue(i, "col6", -(s.getValue(i, "col6"))); |
| 63 | s.setValue(i, "col7", !s.getValue(i, "col7")); |
| 64 | if(doProfiling){ |
| 65 | console.profileEnd(); |
| 66 | } |
| 67 | }; |
| 68 | })); |
| 69 | doh.register(searchParamsAsObj(true).rows + " rows - new/delete", |
| 70 | getRLSTests(function(rows, layout, rowSelector, doProfiling, isPerf){ |
| 71 | return function(t){ |
| 72 | if(doProfiling){ |
| 73 | console.profile("newItem()"); |
| 74 | } |
| 75 | var i = s.newItem({id: cnt, |
| 76 | col1: "normal", |
| 77 | col2: false, |
| 78 | col3: "new", |
| 79 | col4: 'But are not followed by two hexadecimal', |
| 80 | col5: 29.91, |
| 81 | col6: 10, |
| 82 | col7: false }); |
| 83 | cnt++; |
| 84 | if(doProfiling){ |
| 85 | console.profileEnd(); |
| 86 | console.profile("deleteItem()"); |
| 87 | } |
| 88 | s.deleteItem(i); |
| 89 | if(doProfiling){ |
| 90 | console.profileEnd(); |
| 91 | } |
| 92 | }; |
| 93 | })); |
| 94 | doh.run(); |
| 95 | }; |
| 96 | s.fetch({onComplete: cb}); |
| 97 | }); |
| 98 | </script> |
| 99 | </head> |
| 100 | <body class="tundra"> |
| 101 | <div class="heading">Performance Test: dojox.grid.DataGrid dojo.data Notification</div> |
| 102 | </body> |
| 103 | </html> |