source: Dev/trunk/src/client/dojox/app/tests/layoutApp2/views/itemDetails.js

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

Added Dojo 1.9.3 release.

File size: 1.3 KB
Line 
1define([],
2function(){
3
4        var listStore = null;   //list data
5        var currentItem = null;
6
7        return {
8                // show an item detail
9                setDetailsContext: function(index){
10                        // only set the cursor if it is different and valid
11                        if(parseInt(index) < listStore.data.length){
12                                currentItem = listStore.data[index];
13                                this.First.set("value",currentItem.First);
14                                this.Last.set("value",currentItem.Last);
15                                this.Email.set("value",currentItem.Email);
16                                this.Tel.set("value",currentItem.Tel);
17                        }
18                },
19
20                // list view init
21                init: function(){
22                        listStore = this.loadedStores.listStore;
23                },
24
25                beforeActivate: function(){
26                        // summary:
27                        //              view life cycle beforeActivate()
28                        //
29                        // if this.params["cursor"] is set use it to set the selected Details Context
30                        if(this.params["cursor"] || this.params["cursor"] == 0){
31                                this.setDetailsContext(this.params["cursor"]);
32                        }
33                },
34
35                beforeDeactivate: function(){
36                        // summary:
37                        //              view life cycle beforeDeactivate()
38                        //
39                        // put any updates back to the store
40                        currentItem.label = this.First.get("value") + " " + this.Last.get("value");
41                        currentItem.First = this.First.get("value");
42                        currentItem.Last = this.Last.get("value");
43                        currentItem.Email = this.Email.get("value");
44                        currentItem.Tel = this.Tel.get("value");
45                        listStore.put(currentItem);
46                }
47        }
48});
Note: See TracBrowser for help on using the repository browser.