| 1 |
define([], |
| 2 |
function(){ |
| 3 |
|
| 4 |
var listStore = null; |
| 5 |
var currentItem = null; |
| 6 |
|
| 7 |
return { |
| 8 |
|
| 9 |
setDetailsContext: function(index){ |
| 10 |
|
| 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 |
|
| 21 |
init: function(){ |
| 22 |
listStore = this.loadedStores.listStore; |
| 23 |
}, |
| 24 |
|
| 25 |
beforeActivate: function(){ |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
if(this.params["cursor"] || this.params["cursor"] == 0){ |
| 31 |
this.setDetailsContext(this.params["cursor"]); |
| 32 |
} |
| 33 |
}, |
| 34 |
|
| 35 |
beforeDeactivate: function(){ |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 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 |
}); |