source: Dev/trunk/src/client/dojox/app/tests/nestedTestApp/views/S1.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 2.1 KB
Line 
1define(["dojo/dom", "dojo/dom-style", "dojo/_base/connect", "dojo/store/Memory", "dojo/store/Observable", "dojo/sniff"],
2function(dom, domStyle, connect, Memory, Observable, has){
3
4                var _connectResults = []; // events connect result
5                var backId = 'sc1back1';
6                var insert10Id = 'sc1insert10x';
7                var app = null;
8                var MODULE = "S1";
9
10                var loadMore = function(){
11                        if(!app){
12                                return;
13                        }
14                        if(!app.listStart){
15                                app.listStart = 1;
16                                app.listCount = 5;
17                        }
18                        setTimeout(function(){ // to simulate network latency
19                                for(var i = app.listStart; i < app.listStart+5; i++){
20                                        var newdata = {'label': 'Item #'+i};
21                                        app.stores.longlistStore.store.put(newdata);
22                                }
23                                app.listStart += app.listCount;
24                                app.listTotal = app.listStart-1;                               
25                                return false;
26                        }, 500);
27                };
28        return {
29                init: function(){
30                        app = this.app;
31                        var memoryStore = new Memory({data: {}});
32                        new Observable(memoryStore);
33
34                        var connectResult;
35                        connectResult = connect.connect(dom.byId(insert10Id), "click", function(){
36                                //Add 10 items to the end of the model
37                                loadMore();
38                        });
39                        _connectResults.push(connectResult);
40                },
41
42
43                beforeActivate: function(){
44                        // summary:
45                        //              view life cycle beforeActivate()
46                        //console.log(MODULE+" beforeActivate");
47                        if(dom.byId(backId) && !has("phone")){
48                                domStyle.set(dom.byId(backId), "visibility", "hidden"); // hide the back button in tablet mode
49                        }
50                        if(dom.byId("tab1WrapperA")){
51                                domStyle.set(dom.byId("tab1WrapperA"), "visibility", "visible");  // show the nav view if it being used
52                                domStyle.set(dom.byId("tab1WrapperB"), "visibility", "visible");  // show the nav view if it being used
53                        }
54                },
55
56                afterActivate: function(){
57                        // summary:
58                        //              view life cycle afterActivate()
59                        //console.log(MODULE+" afterActivate");
60                },
61                beforeDeactivate: function(){
62                        //console.log(MODULE+" beforeDeactivate");
63                },
64                afterDeactivate: function(){
65                        //console.log(MODULE+" afterDeactivate");
66                },
67
68                destroy: function(){
69                        var connectResult = _connectResults.pop();
70                        while(connectResult){
71                                connect.disconnect(connectResult);
72                                connectResult = _connectResults.pop();
73                        }
74                }
75        };
76});
Note: See TracBrowser for help on using the repository browser.