Debian Codegraph @

dojox/app/tests/scrollableTestApp/scrollableTestApp.js

raw symbols SCIP
1 define(["dojox/mobile/ProgressIndicator", "dojox/mobile/TransitionEvent", "dojox/mvc/getStateful"], function(ProgressIndicator, TransitionEvent, getStateful){
2 return function(){
3 // the default select_item is 0, or will throw an error if directly transition to #details,EditTodoItem view
4 this.selected_item = 0;
5 this.selected_configuration_item = 0;
6 this.progressIndicator = null;
7 /*
8 * show or hide global progress indicator
9 */
10
11 // show an item detail
12 this.setDetailsContext = function(index){
13 if(this.loadedModels.repeatmodels) {
14 this.loadedModels.repeatmodels.set("cursorIndex", index);
15 }
16 };
17
18 // global for call from template
19 this.removeScrollableItem = function(index){
20 this.loadedModels.repeatmodels.model.splice(index, 1);
21 return false;
22 };
23
24 // insert an item
25 this.insertResult = function(index, e){
26 var repeatmodel = this.loadedModels.repeatmodels;
27 if(index<0 || index>repeatmodel.model.length){
28 throw Error("index out of data model.");
29 }
30 if((repeatmodel.model[index].First=="") ||
31 (repeatmodel.model[index+1] && (repeatmodel.model[index+1].First == ""))){
32 return;
33 }
34 var data = {id:Math.random(), "First": "", "Last": "", "Location": "CA", "Office": "", "Email": "", "Tel": "", "Fax": ""};
35 repeatmodel.model.splice(index+1, 0, new getStateful(data));
36 this.setDetailsContext(index+1);
37 var transOpts = {
38 title : "repeatDetails",
39 target : "repeatDetails",
40 url : "#repeatDetails", // this is optional if not set it will be created from target
41 params : {"cursor":index+1}
42 };
43 new TransitionEvent(e.target, transOpts, e).dispatch();
44
45 };
46
47
48 this.showProgressIndicator = function(show){
49
50 if(!this.progressIndicator){
51 this.progressIndicator = ProgressIndicator.getInstance({removeOnStop:false, startSpinning:true, size:40, center:true, interval:30});
52 // TODO: use dojo.body will throw no appendChild method error.
53 var body = document.getElementsByTagName("body")[0];
54 body.appendChild(this.progressIndicator.domNode);
55 this.progressIndicator.domNode.style.zIndex = 999;
56 }
57 if(show){
58 this.progressIndicator.domNode.style.visibility = "visible";
59 this.progressIndicator.start();
60 }else{
61 this.progressIndicator.stop();
62 this.progressIndicator.domNode.style.visibility = "hidden";
63 }
64
65 }
66 };
67 });