0

私の ASP.NET プロジェクトでは、いくつかの dojo UI 要素を使用しようとしました。私の最初の試みは、道場のドキュメントに示されているようなツリーでした。しかし、ブラウザ ページを更新した後、ツリーは展開されたノードの状態を保持することを拒否します。

require([
            "dojo/ready", "dojo/_base/window", "dojo/store/Memory",
            "dijit/tree/ObjectStoreModel", "dijit/Tree"
        ], function (ready, win, Memory, ObjectStoreModel, Tree) {

            // Create test store, adding the getChildren() method required by ObjectStoreModel
            var myStore = new Memory({
                data: [
                    { id: 'world', name: 'The earth', type: 'planet', population: '6 billion' },
                    { id: 'AF', name: 'Africa', type: 'continent', parent: 'world'
                    },
                        { id: 'EG', name: 'Egypt', type: 'country', parent: 'AF' },
                        { id: 'KE', name: 'Kenya', type: 'country', parent: 'AF' },
                            { id: 'Nairobi', name: 'Nairobi', type: 'city', parent: 'KE' },
                            { id: 'Mombasa', name: 'Mombasa', type: 'city', parent: 'KE' },
                        { id: 'SD', name: 'Sudan', type: 'country', parent: 'AF' },
                            { id: 'Khartoum', name: 'Khartoum', type: 'city', parent: 'SD' },
                    { id: 'AS', name: 'Asia', type: 'continent', parent: 'world' },
                        { id: 'CN', name: 'China', type: 'country', parent: 'AS' },
                        { id: 'IN', name: 'India', type: 'country', parent: 'AS' },
                        { id: 'RU', name: 'Russia', type: 'country', parent: 'AS' },
                        { id: 'MN', name: 'Mongolia', type: 'country', parent: 'AS' },
                    { id: 'OC', name: 'Oceania', type: 'continent', population: '21 million', parent: 'world' },
                    { id: 'EU', name: 'Europe', type: 'continent', parent: 'world' },
                        { id: 'DE', name: 'Germany', type: 'country', parent: 'EU' },
                        { id: 'FR', name: 'France', type: 'country', parent: 'EU' },
                        { id: 'ES', name: 'Spain', type: 'country', parent: 'EU' },
                        { id: 'IT', name: 'Italy', type: 'country', parent: 'EU' },
                    { id: 'NA', name: 'North America', type: 'continent', parent: 'world' },
                    { id: 'SA', name: 'South America', type: 'continent', parent: 'world' }
                ],
                getChildren: function (object) {
                    return this.query({ parent: object.id });
                }
            });

            // Create the model
            var myModel = new ObjectStoreModel({
                store: myStore,
                query: { id: 'world' }
            });

            // Create the Tree.   Note that all widget creation should be inside a dojo.ready().
            ready(function () {
                var tree = new Tree({
                    model: myModel,
                    persist: true
                });
                tree.placeAt("tree2");
                tree.startup();
            });
        });
    </script>

    <div id="tree2"></div>

クッキーが有効になっています。これをクライアント側だけで実現したい。chrome、firefox、IEで試してみました。

4

1 に答える 1