| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <title>Test IFWS Bug</title> |
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> |
|---|
| 6 | <style> |
|---|
| 7 | #controls { |
|---|
| 8 | padding: 6px 0; |
|---|
| 9 | } |
|---|
| 10 | </style> |
|---|
| 11 | <script type="text/javascript" src="dojo/dojo.js" |
|---|
| 12 | djConfig="isDebug: true, debugAtAllCosts: false, parseOnLoad: true"></script> |
|---|
| 13 | <script type="text/javascript"> |
|---|
| 14 | dojo.require("dojo.data.ItemFileWriteStore"); |
|---|
| 15 | dojo.require("dojo.parser"); |
|---|
| 16 | </script> |
|---|
| 17 | |
|---|
| 18 | <script type="text/javascript"> |
|---|
| 19 | var egypt = null; |
|---|
| 20 | function setEgypt(items){ |
|---|
| 21 | if(items.length > 0) |
|---|
| 22 | egypt = items[0]; |
|---|
| 23 | } |
|---|
| 24 | var nairobi = null; |
|---|
| 25 | function setNairobi(items){ |
|---|
| 26 | if(items.length > 0) |
|---|
| 27 | nairobi = items[0]; |
|---|
| 28 | } |
|---|
| 29 | dojo.addOnLoad(function() { |
|---|
| 30 | jsonStore.fetch({query: {name: "Egypt"}, onComplete: setEgypt}); |
|---|
| 31 | jsonStore.fetch({query: {name: "Nairobi"}, onComplete: setNairobi}); |
|---|
| 32 | }); |
|---|
| 33 | |
|---|
| 34 | removeEgypt = function() { |
|---|
| 35 | console.debug(egypt); |
|---|
| 36 | jsonStore.deleteItem(egypt); |
|---|
| 37 | console.debug('done deleting Egypt'); |
|---|
| 38 | } |
|---|
| 39 | removeNairobi = function() { |
|---|
| 40 | console.debug(nairobi); |
|---|
| 41 | jsonStore.deleteItem(nairobi); |
|---|
| 42 | console.debug('done deleting Nairobi'); |
|---|
| 43 | } |
|---|
| 44 | query = function() { |
|---|
| 45 | var params = { |
|---|
| 46 | start: 0, |
|---|
| 47 | count: 20, |
|---|
| 48 | query: {name: "*"}, |
|---|
| 49 | sort: [{attribute: "name", descending: true}], |
|---|
| 50 | queryOptions: null |
|---|
| 51 | }; |
|---|
| 52 | console.debug(params); |
|---|
| 53 | jsonStore.fetch(params); |
|---|
| 54 | console.debug('finished the fetch'); |
|---|
| 55 | } |
|---|
| 56 | </script> |
|---|
| 57 | </head> |
|---|
| 58 | <body class="tundra"> |
|---|
| 59 | <h2> |
|---|
| 60 | IFWS Bug in Revert |
|---|
| 61 | </h2> |
|---|
| 62 | <span>Run these in order, left to right</span> |
|---|
| 63 | <div id="controls"> |
|---|
| 64 | <button onclick="query()">Query</button> |
|---|
| 65 | <button onclick="removeEgypt()">Remove Egypt</button> |
|---|
| 66 | <button onclick="removeNairobi()">Remove Nairobi</button> |
|---|
| 67 | <button onclick="jsonStore.revert()">Revert (Store)</button> |
|---|
| 68 | <button onclick="query()">Query</button> |
|---|
| 69 | </div> |
|---|
| 70 | <span dojoType="dojo.data.ItemFileWriteStore" |
|---|
| 71 | jsId="jsonStore" url="dijit/tests/_data/countries.json"> |
|---|
| 72 | </span> |
|---|