Debian Codegraph @

dojox/mvc/tests/mobile/demo/MobileDemoContactListController.js

raw symbols SCIP
1 define([
2 "dojo/_base/declare",
3 "dijit/registry",
4 "dojox/mvc/getStateful",
5 "dojox/mvc/ListController",
6 "dojox/mvc/StoreRefController"
7 ], function(declare, registry, getStateful, ListController, StoreRefController){
8 // module:
9 // dojox/mvc/tests/mobile/demo/MobileDemoContactListController
10 // summary:
11 // The controller for contact list info for this demo.
12
13 return declare([ListController, StoreRefController], {
14 // summaryScrollableViewId: String
15 // The ID of the scrollable view representing summary (in list).
16 summaryScrollableViewId: "",
17
18 // detailScrollableViewId: String
19 // The ID of the scrollable view representing detail (in form).
20 detailScrollableViewId: "",
21
22 // initialFocusElementId: String
23 // The ID of the element that should get the focus when list selection switches, etc.
24 initialFocusElementId: "",
25
26 setDetailsContext: function(/*String*/ uniqueId){
27 // summary:
28 // Called to move to the repeatdetails page when an item is selected on the WidgetList Data Binding page.
29 // uniqueId: String
30 // The ID of the row.
31
32 this.set("cursorId", uniqueId);
33 registry.byId(this.initialFocusElementId).focus();
34 },
35
36 addEmpty: function(){
37 // summary:
38 // Called to add an empty item when the white plus icon is pressed on the WidgetList Data Binding page.
39
40 var payload = getStateful({
41 uniqueId: "" + Math.random(),
42 First: "",
43 Last: "",
44 Location: "CA",
45 Office: "",
46 Email: "",
47 Tel: "",
48 Fax: ""
49 });
50 this[this._refInModelProp].push(payload);
51 this.set("cursor", payload);
52 registry.byId(this.summaryScrollableViewId).performTransition(this.detailScrollableViewId, 1, "none");
53 registry.byId(this.initialFocusElementId).focus();
54 },
55
56 remove: function(/*String*/ uniqueId){
57 // summary:
58 // Called to remove an item when the red circle minus icon is pressed on the WidgetList Data Binding page.
59
60 for(var model = this[this._refInModelProp], i = 0; i < model.length; i++){
61 if(model[i][this.idProperty] == uniqueId){
62 model.splice(i, 1);
63 if(i < this[this._refInModelProp].get("length")){
64 this.set("cursorIndex", i);
65 }
66 return;
67 }
68 }
69 }
70 });
71 });